<commit_before><?php
/**
 * @package plugins.schedule
 * @subpackage api.filters
 */
class KalturaScheduleResourceFilter extends KalturaScheduleResourceBaseFilter
{
	/* (non-PHPdoc)
	 * @see KalturaFilter::getCoreFilter()
	 */
	protected function getCoreFilter()
	{
		return new ScheduleResourceFilter();
	}
	
	protected function getListResponseType()
	{
		return null;
	}
	
	/* (non-PHPdoc)
	 * @see KalturaRelatedFilter::getListResponse()
	 */
	public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null)
	{
		$type = $this->getListResponseType();

		if(!isset($this->statusEqual) && !isset($this->statusIn))
		{
			$allowedStatus = array(ScheduleResourceStatus::DISABLED,ScheduleResourceStatus::ACTIVE);
			$this->statusIn =  implode(',' , $allowedStatus);
		}

		$c = new Criteria();
		if($type)
		{
			$c->add(ScheduleResourcePeer::TYPE, $type);
		}

		$filter = $this->toObject();
		$filter->attachToCriteria($c);
		$pager->attachToCriteria($c);

		$retrieveStatusDeleted = (isset($this->statusEqual) && $this->statusEqual == ScheduleResourceStatus::DELETED) ||
			(isset($this->statusIn) && strpos($this->statusIn,(string)ScheduleResourceStatus::DELETED) !== false );
		if ($retrieveStatusDeleted)
		{
			ScheduleResourcePeer::setUseCriteriaFilter(false);
			$list = ScheduleResourcePeer::doSelect($c);
			ScheduleResourcePeer::setUseCriteriaFilter(true);
		}
		else
		{
			$list = ScheduleResourcePeer::doSelect($c);
		}

		$resultCount = count($list);
		if ($resultCount && $resultCount < $pager->pageSize)
			$totalCount = ($pager->pageIndex - 1) * $pager->pageSize + $resultCount;
		else
		{
			KalturaFilterPager::detachFromCriteria($c);
			$totalCount = ScheduleResourcePeer::doCount($c);
		}
		
		$response = new KalturaScheduleResourceListResponse();
		$response->objects = KalturaScheduleResourceArray::fromDbArray($list, $responseProfile);
		$response->totalCount = $totalCount;
		return $response;
	}
}
<commit_msg>SUP-19359:be able to retrieve deleted scheduled resources<commit_after><?php
/**
 * @package plugins.schedule
 * @subpackage api.filters
 */
class KalturaScheduleResourceFilter extends KalturaScheduleResourceBaseFilter
{
	/* (non-PHPdoc)
	 * @see KalturaFilter::getCoreFilter()
	 */
	protected function getCoreFilter()
	{
		return new ScheduleResourceFilter();
	}
	
	protected function getListResponseType()
	{
		return null;
	}
	
	/* (non-PHPdoc)
	 * @see KalturaRelatedFilter::getListResponse()
	 */
	public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null)
	{
		$type = $this->getListResponseType();

		if(!isset($this->statusEqual) && !isset($this->statusIn))
		{
			$allowedStatus = array(ScheduleResourceStatus::DISABLED,ScheduleResourceStatus::ACTIVE);
			$this->statusIn =  implode(',' , $allowedStatus);
		}

		$c = new Criteria();
		if($type)
		{
			$c->add(ScheduleResourcePeer::TYPE, $type);
		}

		$filter = $this->toObject();
		$filter->attachToCriteria($c);
		$pager->attachToCriteria($c);

		$retrieveStatusDeleted = (isset($this->statusEqual) && $this->statusEqual == ScheduleResourceStatus::DELETED) ||
			(isset($this->statusIn) && strpos($this->statusIn,(string)ScheduleResourceStatus::DELETED) !== false );
		if ($retrieveStatusDeleted)
		{
			ScheduleResourcePeer::setUseCriteriaFilter(false);
			$list = ScheduleResourcePeer::doSelect($c);
			ScheduleResourcePeer::setUseCriteriaFilter(true);
		}
		else
		{
			$list = ScheduleResourcePeer::doSelect($c);
		}

		$resultCount = count($list);
		if ($resultCount && $resultCount < $pager->pageSize)
			$totalCount = ($pager->pageIndex - 1) * $pager->pageSize + $resultCount;
		else
		{
			KalturaFilterPager::detachFromCriteria($c);
			if ($retrieveStatusDeleted)
			{
				ScheduleResourcePeer::setUseCriteriaFilter(false);
				$totalCount = ScheduleResourcePeer::doCount($c);
				ScheduleResourcePeer::setUseCriteriaFilter(true);
			}
			else
			{
				$totalCount = ScheduleResourcePeer::doCount($c);
			}
		}
		
		$response = new KalturaScheduleResourceListResponse();
		$response->objects = KalturaScheduleResourceArray::fromDbArray($list, $responseProfile);
		$response->totalCount = $totalCount;
		return $response;
	}
}

{'fraction_non_alphanumeric': 0.14875058934464874, 'fraction_numerical': 0.0016501650165016502, 'mean_word_length': 5.4581430745814306, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 37, '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': '18006', 'n_tokens_mistral': 1476, 'n_tokens_neox': 1324, 'n_words': 199}