CPhotogalleryElement :: OnRecalcGalleries: Bitrix method

      
<?php 
//  CPhotogalleryElement :: OnRecalcGalleries()
//  /dist/bitrix/modules/photogallery/classes/general/element.php:150

    
function OnRecalcGalleries($ID$INDEX)
    {
        
$ID doubleval($ID); 
        
        if (
CPhotogalleryElement::CheckElement($ID$arElement$arSection$arGallery))
        {
            
$arFields = array(
                
"IBLOCK_ID" => $arElement["IBLOCK_ID"], 
                
"UF_GALLERY_SIZE" => $arGallery["UF_GALLERY_SIZE"]);
            if (
doubleval($arGallery["UF_GALLERY_SIZE"]) > && $arGallery["UF_GALLERY_RECALC"] != $INDEX)
            {
                
$arGallery["UF_GALLERY_SIZE"] = 0
                
$GLOBALS["UF_GALLERY_RECALC"] = $arFields["UF_GALLERY_RECALC"] = $INDEX
            }
            
$arFields["UF_GALLERY_SIZE"] = $GLOBALS["UF_GALLERY_SIZE"] = $GLOBALS["PHOTOGALLERY_VARS"]["arGalleries"][$arGallery["ID"]]["UF_GALLERY_SIZE"] =(doubleval($arGallery["UF_GALLERY_SIZE"]) + $arElement["FILE"]["FILE_SIZE"]); 
            
$bs = new CIBlockSection;
            
$GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_".$arElement["IBLOCK_ID"]."_SECTION"$arFields);
            
$res $bs->Update($arGallery["ID"], $arFieldsfalsefalse);
        }
        return 
true;
    }