Bitrix Site Manager

OnSiteDelete

event_handler(
 int site_id
);

The OnSiteDelete event fires when a site is deleted. A common task of this handler is to clean the database of records related to the deleted site.

Parameters

ParameterDescription
site_id The ID of the site which is to be deleted.

See Also

Example



<?
// file /bitrix/modules/my_module_id/include.php
class MyClass
{
    // create handler "OnSiteDelete"
    function OnSiteDeleteHandler($site_id)
    {
        // delete related records
        $strSql = "DELETE FROM my_table WHERE SITE_ID=".
                  $DB->ForSql($site_id);
        $rs = $DB->Query($strSql, false, 
                         "FILE: ".__FILE__."<br>LINE: ".__LINE__);
    }
}
?>

Example of handler registration


<?
// register handler "OnSiteDelete"
RegisterModuleDependences("main", "OnSiteDelete", 
                          "my_module_id", "MyClass", 
                          "OnSiteDeleteHandler");
?>