<commit_before><?php
/**
 * OffLog - client  
 * 
 * Config file
 * 
 * PHP version 5
 *
 * LICENSE: MIT License
 *
 * @category   Reporting
 * @package    Reporting
 * @author     jeremy <<EMAIL>>
 * @license    http://en.wikipedia.org/wiki/MIT_License
 * @version    SVN: $Id$
 * @link       http://www.metalcat.net/offlog/
 * 
 */

class offLogClient
{
	/**
	 * Refrence to Gearman Client object
	 * 
	 * @var object 	GearmanClient
	 */
	private $gmClient = null;
	
	/**
	 * Reads in the sharedconfig.php $offLogCfg array for the server details
	 * 
	 * @param array $offLogCfg.
	 */
	function __construct($config = array()) 
	{
		$this->gmClient = new GearmanClient();
	
		foreach ($config['gearmanServers'] AS $serverId => $details)
		{
			$this->gmClient->addServer($details['ip'], $details['port']);
		}		
	}
	
	/**
	 * The main logging function, using doBackground uninterupted script flow
	 * 
	 * @param 	big int	$userId		User ID, big int used to accommodate 
	 * @param 	int		$actionId	action ID as per database setup
	 * @param 	text	$payLoad	Meta data string  
	 * 
	 * @return 	string	job id handel    
	 */
	public function logSimpleAction($userId, $actionId, $payLoad)
	{
		return $this->gmClient->doBackground('logSimple', json_encode(array('userid' => $userId, 'actionId' => $actionId, 'payload' => $payLoad)));
	}	

	
	/**
	 * Place holder for other logging action types
	 */
	public function logWatchedAction($userId, $actionId, $payLoad)
	{
		return $this->logSimpleAction($userId, $actionId, $payLoad);
	}


	/**
	 * Place holder for other logging action types
	 */
	
	public function logWatchedUser($userId, $actionId, $payLoad)
	{
		return $this->logSimpleAction($userId, $actionId, $payLoad);
	}
	
	
	/**
	 * Place holder for other logging action types
	 */
	<commit_msg>updating client to use or ignore payload<commit_after><?php
/**
 * OffLog - client  
 * 
 * Config file
 * 
 * PHP version 5
 *
 * LICENSE: MIT License
 *
 * @category   Reporting
 * @package    Reporting
 * @author     jeremy <<EMAIL>>
 * @license    http://en.wikipedia.org/wiki/MIT_License
 * @version    SVN: $Id$
 * @link       http://www.metalcat.net/offlog/
 * 
 */

class offLogClient
{
	/**
	 * Refrence to Gearman Client object
	 * 
	 * @var object 	GearmanClient
	 */
	private $gmClient = null;
	
	/**
	 * Reads in the sharedconfig.php $offLogCfg array for the server details
	 * 
	 * @param array $offLogCfg.
	 */
	function __construct($config = array()) 
	{
		$this->gmClient = new GearmanClient();
	
		foreach ($config['gearmanServers'] AS $serverId => $details)
		{
			$this->gmClient->addServer($details['ip'], $details['port']);
		}		
	}
	
	/**
	 * The main logging function, using doBackground uninterupted script flow
	 * 
	 * @param 	big int	$userId		User ID, big int used to accommodate 
	 * @param 	int		$actionId	action ID as per database setup
	 * @param 	text	$payLoad	Meta data string  
	 * 
	 * @return 	string	job id handel    
	 */
	public function logSimpleAction($userId, $actionId, $payLoad = NULL)
	{
		if ($payLoad)
		{
			return $this->gmClient->doBackground('logSimple', json_encode(array('userid' => $userId, 'actionId' => $actionId, 'payload' => $payLoad)));
		}
		else
		{
			return $this->gmClient->doBackground('logSimple', json_encode(array('userid' => $userId, 'actionId' => $actionId)));
		}
	}	

	
	/**
	 * Place holder for other logging action types
	 */
	public function logWatchedAction($userId, $actionId, $payLoad)
	{
		return $this->logSimpleAction($userId, $actionId, $payLoad);
	}


	/**
	 * Place holder for other logging action types
	 */
	
	public function logWatchedUser($userId, $actionId, $payLoad)
	{
		return $this->logSimpleAction($userId, $actionId, $payLoad);
	}
	
	
	/**
	 * Place holder for other logging action types
	 */
	
{'fraction_non_alphanumeric': 0.13946117274167988, 'fraction_numerical': 0.0005282620179609086, 'mean_word_length': 3.3034090909090907, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1407319', 'n_tokens_mistral': 1351, 'n_tokens_neox': 1230, 'n_words': 328}