<?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
 * @copyright Copyright (c) 2012 - 2013 clearFusionCMS. All rights reserved.
 * @link http://clearfusioncms.com
 */

/**
 * cfBackendClearcacheAction Class
 *
 * The action class to clear the site data cache.
 *
 * @package clearFusionCMS
 */
class cfBackendClearcacheAction extends cfBackendControllerAction {

	/**
	 * Process the page.
	 */
	function process() {
		$this->testPermission('core.clearcache');
		$this->breadcrumbTrail->addCrumb(__('Clear Cache', 'cfBackend'), $this->assemble('', 'clearcache'));

		$this->cache->flush();

		clearFusionCMS::getEventManager()->notify(new flEvent('system.cacheForceFlush'));

		$this->renderPage(__('Clear Site Data Cache', 'cfBackend'),
			$this->renderBlock(__('Clear Site Data Cache', 'cfBackend'), '', '',
			$this->alertMessage('Done', __('The data cache for the site has been cleared.', 'cfBackend')))
		);
	}
}
