Exemplo n.º 1
0
 function _deleteDroppedFiles($arFiles)
 {
     if (!is_array($arFiles) || sizeof($arFiles) <= 0) {
         return false;
     }
     static $arRootID = array();
     $ibe = new CIBlockElement();
     $dbWDFile = $ibe->GetList(array(), array('ID' => $arFiles), false, false, array('ID', 'NAME', 'IBLOCK_SECTION_ID', 'IBLOCK_ID'));
     if ($dbWDFile) {
         while ($arWDFile = $dbWDFile->Fetch()) {
             $id = $arWDFile['ID'];
             if (!isset($arRootID[$arWDFile['IBLOCK_ID']])) {
                 $dbChain = CIBlockSection::GetNavChain($arWDFile['IBLOCK_ID'], $arWDFile['IBLOCK_SECTION_ID']);
                 if ($dbChain && ($arChain = $dbChain->Fetch())) {
                     $arRootID[$arWDFile['IBLOCK_ID']] = $arChain['ID'];
                 }
             }
             if (isset($arRootID[$arWDFile['IBLOCK_ID']])) {
                 $rootID = $arRootID[$arWDFile['IBLOCK_ID']];
                 $ob = new CWebDavIblock($arWDFile['IBLOCK_ID'], '', array("ROOT_SECTION_ID" => $rootID));
                 // for user .dropped files
                 $ob->DeleteDroppedFile($id);
             }
         }
     }
     foreach ($arRootID as $iblockID => $rootID) {
         $ob = new CWebDavIblock($iblockID, '', array("ROOT_SECTION_ID" => $rootID));
         $ob->CleanUpDropped();
     }
 }