public function down() { $helper = new IblockHelper(); $ok = $helper->deleteIblockIfExists('content_news'); if ($ok) { $this->outSuccess('Инфоблок удален'); } else { $this->outError('Ошибка удаления инфоблока'); } }
public function down() { //Удаляем все элементы по 10 штук за раз $helper = new IblockHelper(); $iblockId1 = $helper->getIblockId('content_news'); /** @noinspection PhpDynamicAsStaticMethodCallInspection */ $dbRes = \CIBlockElement::GetList(array(), array('IBLOCK_ID' => $iblockId1), false, array('nTopCount' => 10)); $bFound = 0; while ($aItem = $dbRes->Fetch()) { \CIBlockElement::Delete($aItem['ID']); $this->out('deleted %d', $aItem['ID']); $bFound++; } if ($bFound) { $this->restart(); } }