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/cvetdv.ru/bitrix/modules/yandex.market/lib/export/run/writer/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/yandex.market/lib/export/run/writer/indexfacade.php
<?php

namespace Yandex\Market\Export\Run\Writer;

use Yandex\Market;

class IndexFacade
{
	public static function isAllowed()
	{
		return (Market\Config::getOption('export_writer_index', 'Y') === 'Y');
	}

	public static function resolve($setupId, $fileName)
	{
		$allowed = static::isAllowed();
		$found = static::search($setupId, $fileName);

		if ($allowed === $found) { return false; }

		if ($allowed)
		{
            static::remove($setupId);
			static::create($setupId, $fileName);
		}
		else
		{
			static::remove($setupId);
		}

		return true;
	}

	public static function create($setupId, $fileName)
	{
		$saveResult = FileIndex\RegistryTable::add([
            'SETUP_ID' => $setupId,
            'FILE_NAME' => $fileName,
			'FILE_SIZE' => 0,
        ]);

		Market\Result\Facade::handleException($saveResult);

		return $saveResult->getId();
	}

	public static function remove($setupId)
	{
		$positionResult = FileIndex\PositionTable::deleteBatch([
			'filter' => [ '=SETUP_ID' => $setupId ],
		]);
		$registryResult = FileIndex\RegistryTable::deleteBatch([
            'filter' => [ '=SETUP_ID' => $setupId ],
        ]);

		Market\Result\Facade::handleException($positionResult);
		Market\Result\Facade::handleException($registryResult);
	}

	public static function search($setupId, $fileName = null)
	{
        $filter = [
            '=SETUP_ID' => $setupId,
        ];

        if ($fileName !== null)
        {
            $filter['=FILE_NAME'] = $fileName;
        }

		$query = FileIndex\RegistryTable::getList([
			'filter' => $filter,
			'select' => [ 'SETUP_ID' ],
			'limit' => 1,
		]);

		return (bool)$query->fetch();
	}

	public static function reset($setupId)
	{
		static::resetByFilter([
			'filter' => [ '=SETUP_ID' => $setupId ],
		]);
	}

	public static function resetAll()
	{
		static::resetByFilter([]);
	}

	protected static function resetByFilter(array $parameters)
	{
		$deleteResult = FileIndex\RegistryTable::deleteBatch($parameters);
		// leave PositionTable for parallel agent execution

		Market\Result\Facade::handleException($deleteResult);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit