<commit_before><?php
require_once '/usr/local/measureit/measureit.cfg.php';

class mydb{

	function mydb(){
		global $database_host, $database_name, $database_port, $database_user, $database_passwd;
		$this->connect($database_host.':'.$database_port,$database_user,$database_passwd,$database_name);
	}

	function connect($host,$user,$pass,$datenbank){
		$this->link = mysql_connect($host,$user,$pass) or die ("Datenbankverbindung nicht moeglich!");
		$this->choosedb($datenbank);
	}

	function choosedb($datenbank){
		mysql_select_db($datenbank) or die ("Datenbank konnte nicht ausgewaehlt werden!");
	}

	function query($query){
		$res = mysql_query($query, $this->link) or die ("SQL Abfrage ist ungueltig. ".mysql_error());
		return $res;
	}

	function fetch_array($res){
		return mysql_fetch_array($res);
	}

	function fetch_row($res){
		return mysql_fetch_row($res);
	}

	function num_rows($res){
		return mysql_num_rows($res);
	}
   
	function insert_id(){
		return mysql_insert_id();
	}
	
	function backup(){
		global $database_host, $database_name, $database_port, $database_user, $database_passwd;
		set_time_limit(0);
		#var_dump('mysqldump --opt -h'.$database_host.':'.$database_port.' -u'.$database_user.' -p'.$database_passwd.' '.$database_name.' | gzip > ../backup/measureit_backup_'.@date('Ymd-His').'.gz');
		system( 'mysqldump --opt -h'.$database_host.' -u'.$database_user.' -p'.$database_passwd.' '.$database_name.' | gzip > ../backup/measureit_backup_'.date('Ymd-His').'.gz' );
	}

}

$db = new mydb;

?><commit_msg>running backup in background to prevent gateway timeouts at large databases.<commit_after><?php
require_once '/usr/local/measureit/measureit.cfg.php';

class mydb{

	function mydb(){
		global $database_host, $database_name, $database_port, $database_user, $database_passwd;
		$this->connect($database_host.':'.$database_port,$database_user,$database_passwd,$database_name);
	}

	function connect($host,$user,$pass,$datenbank){
		$this->link = mysql_connect($host,$user,$pass) or die ("Datenbankverbindung nicht moeglich!");
		$this->choosedb($datenbank);
	}

	function choosedb($datenbank){
		mysql_select_db($datenbank) or die ("Datenbank konnte nicht ausgewaehlt werden!");
	}

	function query($query){
		$res = mysql_query($query, $this->link) or die ("SQL Abfrage ist ungueltig. ".mysql_error());
		return $res;
	}

	function fetch_array($res){
		return mysql_fetch_array($res);
	}

	function fetch_row($res){
		return mysql_fetch_row($res);
	}

	function num_rows($res){
		return mysql_num_rows($res);
	}
   
	function insert_id(){
		return mysql_insert_id();
	}
	
	function backup(){
		global $database_host, $database_name, $database_port, $database_user, $database_passwd;
		set_time_limit(0);
		#var_dump('mysqldump --opt -h'.$database_host.':'.$database_port.' -u'.$database_user.' -p'.$database_passwd.' '.$database_name.' | gzip > ../backup/measureit_backup_'.@date('Ymd-His').'.gz');
		system( 'mysqldump --opt -h'.$database_host.' -u'.$database_user.' -p'.$database_passwd.' '.$database_name.' | gzip > ../backup/measureit_backup_'.@date('Ymd-His').'.gz &' );
		return true;
	}

}

$db = new mydb;

?>
{'fraction_non_alphanumeric': 0.17846935535090505, 'fraction_numerical': 0.0006351222610352493, 'mean_word_length': 5.494845360824742, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '2963048', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1124, 'n_words': 198}