<commit_before><?php

class DeleteNewsletterArchivedObjectTask extends DailyTask{
	static $trunk_length = 50;
	static $days_for_newsletters;
	static $days_for_recipients;

	public function process() {
		$config = DataObject::get_one("SiteConfig");
		if($config && $config->exists()){
			if(!$config->DaysAfterWhichArchivedNewslettersDeleted){
				return false;
			}else{
				$total_deleted = $this->deleting_by_type("Newsletter", $config->DaysAfterWhichArchivedNewslettersDeleted);
				echo $total_deleted." newsletters deleted permanently";
			}

			if(!$config->DaysAfterWhichArchivedRecipientsDeleted){
				return false;
			}else{
				$total_deleted = $this->deleting_by_type("Recipient", $config->DaysAfterWhichArchivedRecipientsDeleted);
				echo $total_deleted." recipients deleted permanently";
			}
		}

		return false;
	}

	public function deleting_by_type($type, $days){
		$start = 0;<commit_msg>BUG: fix code convention rule: "120 chars" line length Give a better output when SiteConfig::DaysAfterWhichArchivedNewslettersDeleted is 0 Give a better output when SiteConfig::DaysAfterWhichArchivedRecipientsDeleted is 0<commit_after><?php

class DeleteNewsletterArchivedObjectTask extends DailyTask{
	static $trunk_length = 50;
	static $days_for_newsletters;
	static $days_for_recipients;

	public function process() {
		$config = DataObject::get_one("SiteConfig");
		if($config && $config->exists()){
			if($config->DaysAfterWhichArchivedNewslettersDeleted === 0){
				echo "no newsletter has been deleted permanently";
			}else{
				$total_deleted = $this->deleting_by_type("Newsletter", $config->DaysAfterWhichArchivedNewslettersDeleted);
				echo $total_deleted." newsletters deleted permanently";
			}

			if($config->DaysAfterWhichArchivedRecipientsDeleted === 0){
				echo "no recipients has been deleted permanently";
			}else{
				$total_deleted = $this->deleting_by_type("Recipient", $config->DaysAfterWhichArchivedRecipientsDeleted);
				echo $total_deleted." recipients deleted permanently";
			}
		}

		return false;
	}

	public function deleting_by_type($type, $days){
		$start = 0;
{'fraction_non_alphanumeric': 0.11026615969581749, 'fraction_numerical': 0.006178707224334601, 'mean_word_length': 5.901639344262295, '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': '6429078', 'n_tokens_mistral': 732, 'n_tokens_neox': 623, 'n_words': 137}