Piwik\Plugins\SitesManager\API::deleteSite PHP Method

deleteSite() public method

Requires Super User access.
public deleteSite ( integer $idSite )
$idSite integer
    public function deleteSite($idSite)
    {
        Piwik::checkUserHasSuperUserAccess();
        $idSites = $this->getSitesId();
        if (!in_array($idSite, $idSites)) {
            throw new Exception("website id = {$idSite} not found");
        }
        $nbSites = count($idSites);
        if ($nbSites == 1) {
            throw new Exception(Piwik::translate("SitesManager_ExceptionDeleteSite"));
        }
        $this->getModel()->deleteSite($idSite);
        /**
         * Triggered after a site has been deleted.
         *
         * Plugins can use this event to remove site specific values or settings, such as removing all
         * goals that belong to a specific website. If you store any data related to a website you
         * should clean up that information here.
         *
         * @param int $idSite The ID of the site being deleted.
         */
        Piwik::postEvent('SitesManager.deleteSite.end', array($idSite));
    }