advertising :: UnInstallDB: Bitrix method

      
<?php 
//  advertising :: UnInstallDB()
//  /dist/bitrix/modules/advertising/install/index.php:208

    
function UnInstallDB()
    {
        global 
$APPLICATION$DB$errors;

        if (!
array_key_exists("savedata"$_REQUEST) || $_REQUEST["savedata"] !== "Y")
        {
            
$errors false;
            
// delete whole base
            
$errors $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/advertising/install/db/".strtolower($DB->type)."/uninstall.sql");

            if (!empty(
$errors))
            {
                
$APPLICATION->ThrowException(implode(""$errors));
                return 
false;
            }
        }

        
// agents
        
CAgent::RemoveModuleAgents("advertising");

        
// module events
        
UnRegisterModuleDependences("main""OnBeforeRestartBuffer""advertising""CAdvBanner""BeforeRestartBuffer");
        
UnRegisterModuleDependences("main""OnEndBufferContent""advertising""CAdvBanner""FixShowAll");
        
UnRegisterModuleDependences("main""OnBeforeProlog""advertising");

        
UnRegisterModuleDependences('conversion''OnGetCounterTypes' 'advertising''\Bitrix\Advertising\Internals\ConversionHandlers''onGetCounterTypes');
        
UnRegisterModuleDependences('conversion''OnGetRateTypes' 'advertising''\Bitrix\Advertising\Internals\ConversionHandlers''onGetRateTypes');
        
UnRegisterModuleDependences('advertising''onBannerClick''advertising''\Bitrix\Advertising\Internals\ConversionHandlers''onBannerClick');

        
UnRegisterModule("advertising");

        return 
true;
    }