<commit_before><?php

namespace ATPCore;

class Module extends \ATP\Module
{
	protected $_moduleName = "ATPCore";
	protected $_moduleBaseDir = __DIR__;
	
    public function onBootstrap(\Zend\Mvc\MvcEvent $e)
    {
        $sm = $e->getApplication()->getServiceManager();
		$this->setServiceManager($sm);
		$config = $sm->get('Config');
		
		// Set the db adapter so the models can find it.
		$adapter = $sm->get('ATPCore\Db');
        \ATP\ActiveRecord::setAdapter($adapter);
		
		//Add filter hook to view renderer
		$vm = $sm->get('ViewManager');
		$renderer = $vm->getRenderer();
		
		//Add filters to renderer
		$filterChain = new \ATPCore\Filter\FilterChain();
		$filters = isset($config['block_filters']) ? $config['block_filters'] : array();
		foreach($filters as $type => $class)
		{
			$filter = new $class();
			$filter->setServiceManager($sm);
			$filter->setType($type);
			$filter->setClass($class);
			$filterChain->attach($filter);
		}
		$renderer->setFilterChain($filterChain);
    }
	
	public function getInstallerOptions()
	{
		return array(
			'db_host' => array(
				'label' => 'Database Host',
				'type' => 'Text',
				'default' => 'localhost',
			),
			'db_schema' => array(
				'label' => 'Database Schema',
				'type' => 'Text',
				'default' => 'atp',
			),
			'db_user' => array(
				'label' => 'Database Username',
				'type' => 'Text',
				'default' => 'root',
			),
			'db_pass' => array(
				'label' => 'Database Password',
				'type' => 'Password',
				'default' => '',
			),
		);
	}
	
	public function install($options = array())
	{
		//Setup database parameters
		$configFile = new \ATP\Config\File("config/autoload/global.php");
		$configFile->apply($options);
		$configFile->save();
		
		//Setup a temp adapter for the ActiveRecord classes to use while installing<commit_msg>Use blank config file template<commit_after><?php

namespace ATPCore;

class Module extends \ATP\Module
{
	protected $_moduleName = "ATPCore";
	protected $_moduleBaseDir = __DIR__;
	
    public function onBootstrap(\Zend\Mvc\MvcEvent $e)
    {
        $sm = $e->getApplication()->getServiceManager();
		$this->setServiceManager($sm);
		$config = $sm->get('Config');
		
		// Set the db adapter so the models can find it.
		$adapter = $sm->get('ATPCore\Db');
        \ATP\ActiveRecord::setAdapter($adapter);
		
		//Add filter hook to view renderer
		$vm = $sm->get('ViewManager');
		$renderer = $vm->getRenderer();
		
		//Add filters to renderer
		$filterChain = new \ATPCore\Filter\FilterChain();
		$filters = isset($config['block_filters']) ? $config['block_filters'] : array();
		foreach($filters as $type => $class)
		{
			$filter = new $class();
			$filter->setServiceManager($sm);
			$filter->setType($type);
			$filter->setClass($class);
			$filterChain->attach($filter);
		}
		$renderer->setFilterChain($filterChain);
    }
	
	public function getInstallerOptions()
	{
		return array(
			'db_host' => array(
				'label' => 'Database Host',
				'type' => 'Text',
				'default' => 'localhost',
			),
			'db_schema' => array(
				'label' => 'Database Schema',
				'type' => 'Text',
				'default' => 'atp',
			),
			'db_user' => array(
				'label' => 'Database Username',
				'type' => 'Text',
				'default' => 'root',
			),
			'db_pass' => array(
				'label' => 'Database Password',
				'type' => 'Password',
				'default' => '',
			),
		);
	}
	
	public function install($options = array())
	{
		//Setup database parameters
		$configFile = new \ATP\Config\File("config/autoload/global.php.blank");
		$configFile->apply($options);
		$configFile->save("config/autoload/global.php");
		
		//Setup a temp adapter for the ActiveRecord classes to use while installing
{'fraction_non_alphanumeric': 0.1817687074829932, 'fraction_numerical': 0.0, 'mean_word_length': 3.510429447852761, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 65, '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': '477046', 'n_tokens_mistral': 1395, 'n_tokens_neox': 1202, 'n_words': 267}