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/sproduction.datasync/lib/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/sproduction.datasync/lib/storehandlers.php
<?php
/**
 * Event handlers of store
 *
 * @mail support@s-production.online
 * @link s-production.online
 */
//TODO
namespace SProduction\Datasync;

use Bitrix\Main,
	Bitrix\Main\Type,
	Bitrix\Main\Entity,
	Bitrix\Main\Localization\Loc,
	Bitrix\Main\SiteTable,
	Bitrix\Sale;

Loc::loadMessages(__FILE__);

class StoreHandlers
{
	const HANDLERS = [
		['iblock', 'OnAfterIBlockElementAdd', 'eventOnIBlockElementChanged'],
		['iblock', 'OnAfterIBlockElementUpdate', 'eventOnIBlockElementChanged'],
		['catalog', '\Bitrix\Catalog\Product::onDelete', 'eventOnProductDelete'],
		['catalog', '\Bitrix\Catalog\Price::OnAfterAdd', 'eventOnPriceChanged'],
		['catalog', '\Bitrix\Catalog\Price::OnAfterUpdate', 'eventOnPriceChanged'],
		['iblock', 'OnAfterIBlockSectionAdd', 'eventOnIBlockSectionChanged'],
		['iblock', 'OnAfterIBlockSectionUpdate', 'eventOnIBlockSectionChanged'],
		['iblock', 'OnBeforeIBlockSectionDelete', 'eventOnIBlockSectionDelete'],
	];

	/**
	 * Remove store listeners
	 */
	public static function unreg() {
		$eventManager = \Bitrix\Main\EventManager::getInstance();
		foreach (self::HANDLERS as $handler) {
			$eventManager->unRegisterEventHandler($handler[0], $handler[1], Controller::MODULE_ID, '\SProduction\Datasync\Controller', $handler[2]);
		}
	}

	/**
	 * Listen events of the store
	 */
	public static function reg() {
		$eventManager = \Bitrix\Main\EventManager::getInstance();
		foreach (self::HANDLERS as $handler) {
			$eventManager->registerEventHandler($handler[0], $handler[1], Controller::MODULE_ID, '\SProduction\Datasync\Controller', $handler[2]);
		}
	}

	/**
	 * Check store handlers
	 */
	public static function check() {
		$res = true;
		foreach (self::HANDLERS as $handler) {
			$res &= self::checkHandler($handler);
		}
		return $res;
	}

	public static function checkHandler($handler) {
		$res = false;
		$site_handlers = \Bitrix\Main\EventManager::getInstance()->findEventHandlers($handler[0], $handler[1]);
		if ( ! empty($site_handlers)) {
			foreach ($site_handlers as $site_handler) {
				if (
					$site_handler['TO_MODULE_ID'] == Controller::MODULE_ID &&
					$site_handler['TO_CLASS'] == '\SProduction\Datasync\Controller' &&
					$site_handler['TO_METHOD'] == $handler[2]
				) {
					$res = true;
				}
			}
		}
		return $res;
	}

	/**
	 * Get handlers list
	 */
	public static function getList() {
		foreach (self::HANDLERS as $handler) {
			$handler_list = [];
			$handler_module = $handler[0];
			$handler_path = $handler[1];
			$handlers = \Bitrix\Main\EventManager::getInstance()->findEventHandlers($handler_module, $handler_path);
			if ( ! empty($handlers)) {
				foreach ($handlers as $handler) {
					$handler_list[] = $handler;
				}
			}
			$list[$handler_path] = $handler_list;
		}
		return $list;
	}

}

Youez - 2016 - github.com/yon3zu
LinuXploit