<commit_before><?php

//this script may only be included - so its better to die if called directly.
if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== false) {
  header("location: index.php");
}

/*
A basic library to handle a cache of some Tiki Objects,
usage is simple and feel free to improve it
*/

class Cachelib {

  var $folder;

  function Cachelib() {
	global $tikidomain;
	if (!empty($tikidomain) and substr($tikidomain,-1,1) != '/') {
		$tikidomain.= '/';
	}
	$this->folder = "temp/".$tikidomain."cache";
    if(!is_dir($this->folder)) {
  		mkdir($this->folder);
			@chmod($this->folder,"0777");
    }
  }
	
  function cacheItem($key,$data)
  {
	$cache_folder = $this->folder;
	$key = md5($key);
	$fw = fopen($this->folder."/$key","w");
	fwrite($fw,$data);
	fclose($fw);
	return true;
  }
	
  function isCached($key)
  {
	$cache_folder = $this->folder;
	$key = md5($key);
	return file_exists($this->folder."/$key");
  }
	
  function getCached($key)
  {
	$cache_folder = $this->folder;
	$key = md5($key);
	$fw = fopen("$cache_folder/$key","r");
	$data = fread($fw,filesize($this->folder."/$key"));
	fclose($fw);
	return $data;
  }
	
  function invalidate($key)
  {
	$cache_folder = $this->folder;
	$key = md5($key);
	@unlink($this->folder."/$key");
  }
}

$cachelib = new Cachelib();
?>
<commit_msg>fixing the multitiki temp/cache/domain prob<commit_after><?php

//this script may only be included - so its better to die if called directly.
if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== false) {
  header("location: index.php");
}

/*
A basic library to handle a cache of some Tiki Objects,
usage is simple and feel free to improve it
*/

class Cachelib {

  var $folder;

  function Cachelib() {
	global $tikidomain;
	if (!empty($tikidomain) and substr($tikidomain,-1,1) != '/') {
		$tikidomain.= '/';
	}
	$this->folder = "temp/cache/".$tikidomain;
    if(!is_dir($this->folder)) {
  		mkdir($this->folder);
			@chmod($this->folder,"0777");
    }
  }
	
  function cacheItem($key,$data)
  {
	$cache_folder = $this->folder;
	$key = md5($key);
	$fw = fopen($this->folder."/$key","w");
	fwrite($fw,$data);
	fclose($fw);
	return true;
  }
	
  function isCached($key)
  {
	$cache_folder = $this->folder;
	$key = md5($key);
	return file_exists($this->folder."/$key");
  }
	
  function getCached($key)
  {
	$cache_folder = $this->folder;
	$key = md5($key);
	$fw = fopen("$cache_folder/$key","r");
	$data = fread($fw,filesize($this->folder."/$key"));
	fclose($fw);
	return $data;
  }
	
  function invalidate($key)
  {
	$cache_folder = $this->folder;
	$key = md5($key);
	@unlink($this->folder."/$key");
  }
}

$cachelib = new Cachelib();
?>

{'fraction_non_alphanumeric': 0.2072072072072072, 'fraction_numerical': 0.0075075075075075074, 'mean_word_length': 4.056925996204933, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '4093338', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1011, 'n_words': 206}