<commit_before><?php

error_reporting(E_ALL);

require_once(dirname(__FILE__).'/../alpha/config/kConf.php');

// clear kConf defined cache directories
$path = realpath(kConf::get('cache_root_path'));

askToDelete(fixPath(kConf::get('general_cache_dir')));
askToDelete(fixPath(kConf::get('response_cache_dir')));
askToDelete(fixPath(kConf::get('cache_root_path')));

// clear symfony (alpha) cache
system('php '.fixPath(kConf::get('sf_root_dir')).DIRECTORY_SEPARATOR.'symfony cc');
system('php '.fixPath(kConf::get('sf_root_dir')).DIRECTORY_SEPARATOR.'symfony cc');

// clear APC cache
if (function_exists('apc_clear_cache'))
{
	// clear apc system cache
	if (!apc_clear_cache())
	{
		echo 'Unable to clear APC SYSTEM cache!'.PHP_EOL;
	} 
	
	// clear apc user cache
	if (!apc_clear_cache('user'))
	{
		echo 'Unable to clear APC USER cache!'.PHP_EOL;
	}
}

function fixPath($path)
{
	$path = str_replace('\\', '/', $path);
	return realpath($path);
}


function askToDelete($path)
{	
	$baseKalturaPath = realpath(dirname(__FILE__).DIRECTORY_SEPARATOR.'..');
	if (strpos($path, $baseKalturaPath) === 0)
	{
		echo 'Are you sure you want to delete all contents of ['.$path.'] (y/n) ?  ';
		$input = trim(fgets(STDIN));
		if ($input === 'y') {
			echo 'rm -rf '.$path.DIRECTORY_SEPARATOR.'*'.PHP_EOL;
			system('rm -rf '.$path.DIRECTORY_SEPARATOR.'*');
		}
		else {
			echo 'Skipping...'.PHP_EOL;
		}
	}
	else
	{
		echo 'Path ['.$path.'] does not belong to the kaltura server. Skipping.'.PHP_EOL;
	}	
}<commit_msg>Don't delete folders with their permissions<commit_after><?php

error_reporting(E_ALL);

require_once(dirname(__FILE__).'/../alpha/config/kConf.php');

// clear kConf defined cache directories
$path = realpath(kConf::get('cache_root_path'));

askToDelete(fixPath(kConf::get('general_cache_dir')));
askToDelete(fixPath(kConf::get('response_cache_dir')));
askToDelete(fixPath(kConf::get('cache_root_path')));

// clear symfony (alpha) cache
system('php '.fixPath(kConf::get('sf_root_dir')).DIRECTORY_SEPARATOR.'symfony cc');
system('php '.fixPath(kConf::get('sf_root_dir')).DIRECTORY_SEPARATOR.'symfony cc');

// clear APC cache
if (function_exists('apc_clear_cache'))
{
	// clear apc system cache
	if (!apc_clear_cache())
	{
		echo 'Unable to clear APC SYSTEM cache!'.PHP_EOL;
	} 
	
	// clear apc user cache
	if (!apc_clear_cache('user'))
	{
		echo 'Unable to clear APC USER cache!'.PHP_EOL;
	}
}

function fixPath($path)
{
	$path = str_replace('\\', '/', $path);
	return realpath($path);
}


function askToDelete($path)
{	
	$baseKalturaPath = realpath(dirname(__FILE__).DIRECTORY_SEPARATOR.'..');
	if (strpos($path, $baseKalturaPath) === 0)
	{
		echo 'Are you sure you want to delete all contents of ['.$path.'] (y/n) ?  ';
		$input = trim(fgets(STDIN));
		if ($input === 'y') {
			$cmd = 'rm -rf '.$path.DIRECTORY_SEPARATOR.'*'.DIRECTORY_SEPARATOR.'*';
			echo "$cmd\n";
			system($cmd);
			
			$cmd = 'rm -rf '.$path.DIRECTORY_SEPARATOR.'*.*';
			echo "$cmd\n";
			system($cmd);
		}
		else {
			echo 'Skipping...'.PHP_EOL;
		}
	}
	else
	{
		echo 'Path ['.$path.'] does not belong to the kaltura server. Skipping.'.PHP_EOL;
	}	
}
{'fraction_non_alphanumeric': 0.18903410902135798, 'fraction_numerical': 0.000637551801083838, 'mean_word_length': 4.800369685767098, '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': '320838', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1192, 'n_words': 230}