<commit_before><?php
App::uses('AppModel', 'Model');
class EventBlacklist extends AppModel{

	public $useTable = 'event_blacklists';

	public $recursive = -1;

	public $actsAs = array(
			'SysLogLogable.SysLogLogable' => array(	// TODO Audit, logable
					'userModel' => 'User',
					'userKey' => 'user_id',
					'change' => 'full'),
			'Containable',
	);

	public $blacklistFields = array('event_uuid', 'comment', 'event_info', 'event_orgc');

	public $validate = array(
			'event_uuid' => array(
					'unique' => array(
							'rule' => 'isUnique',
							'message' => 'Event already blacklisted.'
					),
					'uuid' => array(
							'rule' => array('uuid'),
							'message' => 'Please provide a valid UUID'
					),
			)
	);

	public function beforeValidate($options = array()) {
		parent::beforeValidate();
		$schema = $this->schema();
		if (!isset($schema['event_info'])) $this->updateDatabase('addEventBlacklistsContext');
		$date = date('Y-m-d H:i:s');
		if (empty($this->data['EventBlacklist']['id'])) {
			$this->data['EventBlacklist']['date_created'] = $date;
		}
		return true;
	}
}<commit_msg>fix: Added default comment to event blacklists, fixes #2080<commit_after><?php
App::uses('AppModel', 'Model');
class EventBlacklist extends AppModel{

	public $useTable = 'event_blacklists';

	public $recursive = -1;

	public $actsAs = array(
			'SysLogLogable.SysLogLogable' => array(	// TODO Audit, logable
					'userModel' => 'User',
					'userKey' => 'user_id',
					'change' => 'full'),
			'Containable',
	);

	public $blacklistFields = array('event_uuid', 'comment', 'event_info', 'event_orgc');

	public $validate = array(
			'event_uuid' => array(
					'unique' => array(
							'rule' => 'isUnique',
							'message' => 'Event already blacklisted.'
					),
					'uuid' => array(
							'rule' => array('uuid'),
							'message' => 'Please provide a valid UUID'
					),
			)
	);

	public function beforeValidate($options = array()) {
		parent::beforeValidate();
		$schema = $this->schema();
		if (!isset($schema['event_info'])) $this->updateDatabase('addEventBlacklistsContext');
		$date = date('Y-m-d H:i:s');
		if (empty($this->data['EventBlacklist']['id'])) {
			$this->data['EventBlacklist']['date_created'] = $date;
		}
		if (empty($this->data['EventBlacklist']['comment'])) {
			$this->data['EventBlacklist']['comment'] = '';
		}
		return true;
	}
}
{'fraction_non_alphanumeric': 0.19797382861967075, 'fraction_numerical': 0.002532714225411566, 'mean_word_length': 4.010570824524313, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '1525919', 'n_tokens_mistral': 941, 'n_tokens_neox': 785, 'n_words': 163}