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/catalog/lib/store/enablewizard/ |
Upload File : |
<?php namespace Bitrix\Catalog\Store\EnableWizard; use Bitrix\Catalog\CatalogIblockTable; use Bitrix\Iblock\ElementTable; use Bitrix\Main\Application; use Bitrix\Main\Type\Collection; final class ProductDisabler { public static function getIblocksForDisabling(): array { $catalogIblocksIterator = CatalogIblockTable::getList([ 'select' => ['IBLOCK_ID'], 'filter' => [ '=PRODUCT_IBLOCK_ID' => 0, ] ]); $iblocks = $catalogIblocksIterator->fetchAll(); $iblocks = array_column($iblocks, 'IBLOCK_ID'); Collection::normalizeArrayValuesByInt($iblocks); return $iblocks; } public static function disable(): void { $iblocks = self::getIblocksForDisabling(); if (empty($iblocks)) { return; } foreach ($iblocks as $iblockId) { \CIBlock::disableClearTagCache(); \Bitrix\Iblock\PropertyIndex\Manager::enableDeferredIndexing(); Application::getConnection()->query(" UPDATE " . ElementTable::getTableName() . " SET ACTIVE = 'N' WHERE IBLOCK_ID = " . (int)$iblockId . " "); \CIBlock::enableClearTagCache(); \Bitrix\Iblock\PropertyIndex\Manager::disableDeferredIndexing(); \CIBlock::clearIblockTagCache($iblockId); \Bitrix\Iblock\PropertyIndex\Manager::runDeferredIndexing($iblockId); } } }