Documentation

OnSiteDelete

handler function(
 int site_id
);
The event OnSiteDelete fires when site is deleted. Usually the purpose of this event handler is to clean the database of records associated with deleted site.

Parameters

ParameterDescription
site_id Deleted site ID.

See Also

Example of handler function:

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

Example of handler function registration:

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


© «Bitrix24», 2001-2022
Up