cache / branches / master / vendors / shells / tasks / clear.php

history
<?php

class ClearTask extends Shell {
	
/**
 * undocumented variable
 *
 * @var string
 */
	var $types = array('views', 'models', 'persistent');
	
/**
 * Cache clearing
 *
 * @return void
 * @access public
 */
	function execute() {
		if (count($this->args) == 0) return $this->help();
		
		$options = array_merge(array('ext' => '', 'type' => null), $this->params);	
		$files = ($this->args[0] === 'all') ? null : $this->args;
		
		if (isset($options['type'])) {
			clearCache($files, $options['type'], '');
		} else {
			foreach ($this->types as $type) {
				clearCache($files, $type, $options['ext']);
			}
		}
	}	
	
	/**
	 * Help for Cache shell
	 *
	 * @return void
	 * @access public
	 */
		function help() {
			$this->out(__("Cache Shell", true));
			$this->out("");
			$this->out(__("\tAllows you to perform list and clear operations on your application caches", true));
			$this->out("");
			$this->out(__("\tUsage:", true));
			$this->out(__("\t\tcake cache clear [-type views] [-ext ] all | [cache_name] [cache_name] ... ", true));
			$this->out("");
			$this->out(__("\tArguments:", true));
			$this->out(__("\t\tclear: \tIf called without [cache_name], clears entire view cache.", true));
			$this->out("");
			$this->hr();
			$this->out("");
		}
}
?>