<commit_before><?php  
/**
 * News Controller
 */
class NewsController extends AppController {

/**
 * cms index
 */
	public function cms_index()
	{
		$this->set('news',$this->paginate());
	}

/**
 * cms create
 */
	public function cms_create()
	{
		if(!empty($this->request->data)) {
			if(empty($this->request->data['News']['expires'])) {
				$this->request->data['News']['archive_date'] = '0000-00-00 00:00:00';
			}
			if($this->News->save($this->request->data)) {
				$this->Session->setFlash(__('News story created'), 'flash_success');
				$this->redirect(array('action'=>'index'));
			}
		}
	}

/**
 * cms edit
 */
	public function cms_edit($id=null)
	{
		$this->News->id = $id;
		if(!$this->News->exists()) {
			throw new NotFoundException(__('News item not found'));	
		}
		if(!empty($this->request->data)) {
			if(empty($this->request->data['News']['expires'])) {
				$this->request->data['News']['archive_date'] = '0000-00-00 00:00:00';
			}
			if($this->News->save($this->request->data)) {
				$this->Session->setFlash(__('News story created'), 'flash_success');
				$this->redirect(array('action'=>'index'));
			}
		} else {
			$this->request->data = $this->News->read(null, $id);
			if($this->request->data['News']['archive_date']=='0000-00-00') {
				unset($this->request->data['News']['archive_date']);
			} else {
				$this->request->data['News']['expires'] = true;
			}
		}
	}


/** 
 * delete
 */
	 public function delete($id=null) {
	 	$this->News->id = $id;
		if(!$this->News->exists()) {
			throw new NotFoundExeption('News story not found');
		}
		$this->News->delete($id);
		$this->Session->setFlash('News story deleted','flash_success');
		$this->redirect(array('action'=>'action'));
	}


}<commit_msg>Fix delete functionality<commit_after><?php  
/**
 * News Controller
 */
class NewsController extends AppController {

/**
 * cms index
 */
	public function cms_index()
	{
		$this->set('news',$this->paginate());
	}

/**
 * cms create
 */
	public function cms_create()
	{
		if(!empty($this->request->data)) {
			if(empty($this->request->data['News']['expires'])) {
				$this->request->data['News']['archive_date'] = '0000-00-00 00:00:00';
			}
			if($this->News->save($this->request->data)) {
				$this->Session->setFlash(__('News story created'), 'flash_success');
				$this->redirect(array('action'=>'index'));
			}
		}
	}

/**
 * cms edit
 */
	public function cms_edit($id=null)
	{
		$this->News->id = $id;
		if(!$this->News->exists()) {
			throw new NotFoundException(__('News item not found'));	
		}
		if(!empty($this->request->data)) {
			if(empty($this->request->data['News']['expires'])) {
				$this->request->data['News']['archive_date'] = '0000-00-00 00:00:00';
			}
			if($this->News->save($this->request->data)) {
				$this->Session->setFlash(__('News story created'), 'flash_success');
				$this->redirect(array('action'=>'index'));
			}
		} else {
			$this->request->data = $this->News->read(null, $id);
			if($this->request->data['News']['archive_date']=='0000-00-00') {
				unset($this->request->data['News']['archive_date']);
			} else {
				$this->request->data['News']['expires'] = true;
			}
		}
	}


/** 
 * delete
 */
	 public function cms_delete($id=null) {
	 	$this->News->id = $id;
		if(!$this->News->exists()) {
			throw new NotFoundExeption('News story not found');
		}
		$this->News->delete($id);
		$this->Session->setFlash('News story deleted','flash_success');
		$this->redirect(array('action'=>'index'));
	}


}
{'fraction_non_alphanumeric': 0.24625144175317185, 'fraction_numerical': 0.020761245674740483, 'mean_word_length': 4.108983799705449, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 111, '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': '3718033', 'n_tokens_mistral': 1387, 'n_tokens_neox': 1208, 'n_words': 164}