<commit_before><?php

error_reporting(E_ALL);

require_once(__DIR__ . '/bootstrap.php');

$interactive = true;
if ($argc == 2 && $argv[1] == '-y')
{
	$interactive = false;
}

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

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

// 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, $interactive)
{	
	$baseKalturaPath = realpath(dirname(__FILE__).DIRECTORY_SEPARATOR.'../..');
	if (strpos($path, $baseKalturaPath) === 0)
	{
		if ($interactive)
		{<commit_msg>cast string/false to string<commit_after><?php

error_reporting(E_ALL);

require_once(__DIR__ . '/bootstrap.php');

$interactive = true;
if ($argc == 2 && $argv[1] == '-y')
{
	$interactive = false;
}

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

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

// 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, $interactive)
{	
	$baseKalturaPath = realpath(dirname(__FILE__).DIRECTORY_SEPARATOR.'../..');
	if (str_starts_with($path, (string)$baseKalturaPath))
	{
		if ($interactive)
		{
{'fraction_non_alphanumeric': 0.17885421518397765, 'fraction_numerical': 0.002328830926874709, 'mean_word_length': 5.609230769230769, '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': '1657685', 'n_tokens_mistral': 822, 'n_tokens_neox': 796, 'n_words': 152}