<?php

/**
 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @package clearFusionCMS\module\comments
 * @copyright Copyright (c) 2013 clearFusionCMS. All rights reserved.
 * @link http://clearfusioncms.com
 */

/**
 * commentsEvents Class
 *
 * Class to process module events.
 *
 * @package clearFusionCMS\module\comments
 */
class commentsEvents {

	/**
	 * Event handler for tracking removed modules.
	 *
	 * @param flEvent $evt The event object.
	 */
	function onModuleRemoved($evt) {
		$m = $evt->getParam('module');

		$siteMgr = new cfSiteManager($db = clearFusionCMS::getDb());
		$sites = $siteMgr->listSites();
		foreach($sites as $site => $n) {
			$db->delete('cf_comments_' . $site, 'modulename=?', $m);
		}
	}
}
