Created
July 13, 2019 08:55
-
-
Save kernusr/2ea930c94e244dcd37d20cb70a67e65f to your computer and use it in GitHub Desktop.
Удалить элементы инфоблока
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Выполнять в командной строке PHP | |
// Настройки>Инструменты>Командная PHP-строка | |
CModule::IncludeModule('iblock'); | |
$arFilter=array('IBLOCK_ID'=>7);//ID инфоблока, который чистим | |
$arNavStartParams=array('nTopCount'=>1663);//Колчество элементов, удаляемых за один проход | |
$rsItems=CIBlockElement::GetList(array(), $arFilter, false, $arNavStartParams, array('ID')); | |
while($arItem = $rsItems->GetNext(false, false)) | |
{ | |
if(!CIBlockElement::Delete($arItem['ID'])) | |
echo 'Ошибка удаления элемента '.$arItem['ID'] . PHP_EOL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment