<commit_before><?php
class Deployment_Model_Tasks_Healthcheck extends Deployment_Model_Tasks_Generic{
	protected $_name = 'Health check';
	
	protected $_description = 'This task checks the server to make sure it\'s not missing anything.';
	
	protected $_autoRun = true;
	
	public function runTask(){
		$returnVal = array();
		
		return $returnVal;
	}
	
	public function isEnabled(){
		if(Speedy_Featuretoggle::enabled(get_class($this))){
			return true;
		}
	}
}<commit_msg>Added support to check the modules needed for the site.<commit_after><?php
class Deployment_Model_Tasks_Healthcheck extends Deployment_Model_Tasks_Generic{
	protected $_name = 'Health check';
	
	protected $_description = 'This task checks the server to make sure it\'s not missing anything.';
	
	protected $_autoRun = true;
	
	protected $_modules = array(
		'required'=>array('mod_rewrite'=>'This module is so required I\'m not even sure how you\'re seeing this message.'),
		'nicetohave'=>array(
				'mod_headers'=>'Provides support to have long lived static files.',
				'mod_expires'=>'Improves long lived static files',
				'mod_gzip'=>'Compresses static files'
		)
	);
	
	public function _checkModules(){
		
		$this->_addResult('## Module Check');
		
		// get the currently loaded modules
		$modules = apache_get_modules();
		
		// the return value
		$returnVal = true;
		
		// loop through all the required modules
		foreach($this->_modules['required'] as $module => $description){
			// check to see if this module
			if(!in_array($module, $modules)){
				$this->_addResult('* Missing required module:' . $module);
				$returnVal = false;
			}
		}
		
		// loop through all the required modules
		foreach($this->_modules['nicetohave'] as $module => $description){
			// check to see if this module
			if(!in_array($module, $modules)){
				$this->_addResult('* Missing optional module:' . $module);
			}
		}
		
		return $returnVal;
	}
	
	public function runTask(){
		$returnVal = true;
		
		if(!$this->_checkModules()){
			$returnVal = false;
		}
		
		return $returnVal;
	}
	
	public function isEnabled(){
		if(Speedy_Featuretoggle::enabled(get_class($this))){
			return true;
		}
	}
}
{'fraction_non_alphanumeric': 0.12707948243992606, 'fraction_numerical': 0.0, 'mean_word_length': 4.094117647058823, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2979244', 'n_tokens_mistral': 734, 'n_tokens_neox': 628, 'n_words': 192}