<commit_before><?php
App::uses('AppModel', 'Model');
/**
 * Job Model
 *
 * @property Job $Job
*/
class Job extends AppModel {

	public $belongsTo = array(
			'Org' => array(
					'className' => 'Organisation',
					'foreignKey' => 'org_id',
					'order' => array(),
					'fields' => array('id', 'name', 'uuid')
			),
		);

	public function beforeValidate($options = array()) {
		parent::beforeValidate();
		$date = date('Y-m-d H:i:s');
		if (empty($this->data['Job']['id'])) {
			$this->data['Job']['date_created'] = $date;
			$this->data['Job']['date_modified'] = $date;
		} else {
			$this->data['Job']['date_modified'] = $date;
		}
	}

	public function cache($type, $user, $target, $jobOrg = null) {
		$extra = null;
		$extra2 = null;
		$shell = 'Event';
		$this->create();
		$data = array(
				'worker' => 'cache',
				'job_type' => 'cache_' . $type,
				'job_input' => $target,
				'status' => 0,
				'retries' => 0,
				'org_id' => $user['Role']['perm_site_admin'] ? 0 : $user['org_id'],
				'message' => 'Fetching events.',
		);
		if ($type === 'md5' || $type === 'sha1' || $type = 'sha256') {
			$extra = $type;
			$type = 'hids';
		}
		if ($type === 'csv_all' || $type === 'csv_sig') {
			$extra = $type;
			$type = 'csv';
		}
		if ($type === 'suricata' || $type === 'snort') {
			$extra = $type;
			$type = 'nids';
			$extra2 = isset($user['nids_sid']) ? $user['nids_sid'] : 0;
		}
		if ($type === 'rpz') $extra = $type;
		$this->save($data);
		$id = $this->id;
		$process_id = CakeResque::enqueue(
				'cache',
				$shell . 'Shell',
				array('cache' . $type, $user['id'], $id, $extra, $extra2),
				true
		);
		$this->saveField('process_id', $process_id);
		return $id;
	}
}
<commit_msg>Fix export for non md5/sha1/sha256 types<commit_after><?php
App::uses('AppModel', 'Model');
/**
 * Job Model
 *
 * @property Job $Job
*/
class Job extends AppModel {

	public $belongsTo = array(
			'Org' => array(
					'className' => 'Organisation',
					'foreignKey' => 'org_id',
					'order' => array(),
					'fields' => array('id', 'name', 'uuid')
			),
		);

	public function beforeValidate($options = array()) {
		parent::beforeValidate();
		$date = date('Y-m-d H:i:s');
		if (empty($this->data['Job']['id'])) {
			$this->data['Job']['date_created'] = $date;
			$this->data['Job']['date_modified'] = $date;
		} else {
			$this->data['Job']['date_modified'] = $date;
		}
	}

	public function cache($type, $user, $target, $jobOrg = null) {
		$extra = null;
		$extra2 = null;
		$shell = 'Event';
		$this->create();
		$data = array(
				'worker' => 'cache',
				'job_type' => 'cache_' . $type,
				'job_input' => $target,
				'status' => 0,
				'retries' => 0,
				'org_id' => $user['Role']['perm_site_admin'] ? 0 : $user['org_id'],
				'message' => 'Fetching events.',
		);
		if ($type === 'md5' || $type === 'sha1' || $type === 'sha256') {
			$extra = $type;
			$type = 'hids';
		}
		if ($type === 'csv_all' || $type === 'csv_sig') {
			$extra = $type;
			$type = 'csv';
		}
		if ($type === 'suricata' || $type === 'snort') {
			$extra = $type;
			$type = 'nids';
			$extra2 = isset($user['nids_sid']) ? $user['nids_sid'] : 0;
		}
		if ($type === 'rpz') $extra = $type;
		$this->save($data);
		$id = $this->id;
		$process_id = CakeResque::enqueue(
				'cache',
				$shell . 'Shell',
				array('cache' . $type, $user['id'], $id, $extra, $extra2),
				true
		);
		$this->saveField('process_id', $process_id);
		return $id;
	}
}

{'fraction_non_alphanumeric': 0.25138524351122776, 'fraction_numerical': 0.008457276173811607, 'mean_word_length': 3.3638676844783717, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, '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': '62938', 'n_tokens_mistral': 1553, 'n_tokens_neox': 1340, 'n_words': 275}