<commit_before><?php
namespace lib\engine\cronjob;

class options
{

	private static function current_cronjob_path()
	{
		return '* * * * * php '. __DIR__ . '/cronjob.php';
	}


	private static function set_cronjob($_active)
	{
		$output = shell_exec('crontab -l');
		$new_crontab_txt = $output;

		if($_active)
		{
			if(self::status())
			{
				// need to active again
				return true;
			}

			$new_crontab_txt .= self::current_cronjob_path(). PHP_EOL;
		}
		else
		{
			if(!self::status())
			{
				// need to deactive again
				return true;
			}

			$new_crontab_txt = str_replace(self::current_cronjob_path(). PHP_EOL, '', $new_crontab_txt);
		}

		file_put_contents(root.'/tmp/crontab.txt', $new_crontab_txt);
		exec('crontab '. root. '/tmp/crontab.txt', $result, $return_val);
		if($return_val === 0)
		{
			return true;
		}
		else
		{
			return false;
		}
	}


	public static function active()
	{
		return self::set_cronjob(true);<commit_msg>fix crontab location<commit_after><?php
namespace lib\engine\cronjob;

class options
{

	private static function current_cronjob_path()
	{
		return '* * * * * php '. __DIR__ . '/cronjob.php';
	}


	private static function set_cronjob($_active)
	{
		$output = shell_exec('crontab -l');
		$new_crontab_txt = $output;

		if($_active)
		{
			if(self::status())
			{
				// need to active again
				return true;
			}

			$new_crontab_txt .= self::current_cronjob_path(). PHP_EOL;
		}
		else
		{
			if(!self::status())
			{
				// need to deactive again
				return true;
			}

			$new_crontab_txt = str_replace(self::current_cronjob_path(). PHP_EOL, '', $new_crontab_txt);
		}

		file_put_contents('/tmp/crontab.txt', $new_crontab_txt);
		exec('crontab /tmp/crontab.txt', $result, $return_val);
		if($return_val === 0)
		{
			return true;
		}
		else
		{
			return false;
		}
	}


	public static function active()
	{
		return self::set_cronjob(true);
{'fraction_non_alphanumeric': 0.15047518479408659, 'fraction_numerical': 0.0010559662090813093, 'mean_word_length': 3.3068181818181817, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2205364', 'n_tokens_mistral': 855, 'n_tokens_neox': 732, 'n_words': 130}