<commit_before><?

defined('C5_EXECUTE') or die(_("Access Denied."));
class DashboardInstallController extends Controller {
	
	protected $errorText = array();
	
	public function __construct() {
		$this->errorText[E_PACKAGE_INSTALLED] = t("You've already installed that package.");		
		$this->errorText[E_PACKAGE_NOT_FOUND] = t("Invalid Package.");
		$this->errorText[E_PACKAGE_VERSION] = t("This package requires concrete version %s or greater.");
		$this->error = Loader::helper('validation/error');
	}
	
	public function packages() {
		$this->set('nav', 'packages');
		$this->set('pkgArray', Package::getInstalledList());
		$this->set('pkgAvailableArray', Package::getAvailablePackages());
	}
	
	private function mapError($testResults) {
		$testResultsText = array();
		foreach($testResults as $result) {
			if (is_array($result)) {
				$et = $this->errorText[$result[0]];
				array_shift($result);
				$testResultsText[] = vsprintf($et, $result);
			} else {
				$testResultsText[] = $this->errorText[$result];
			}
		}
		return $testResultsText;
	}
	
	public function view() {

	}
	
	public function refresh_block_type($btID = 0) {
		if ($btID > 0) {
			$bt = BlockType::getByID($btID);
		}
		
		if (isset($bt) && ($bt instanceof BlockType)) {
			try {
				$resp = BlockType::installBlockType($bt->getBlockTypeHandle(), $btID);			
				if ($resp != '') {
					throw new Exception($resp);<commit_msg>fixing refresh package block function<commit_after><?

defined('C5_EXECUTE') or die(_("Access Denied."));
class DashboardInstallController extends Controller {
	
	protected $errorText = array();
	
	public function __construct() {
		$this->errorText[E_PACKAGE_INSTALLED] = t("You've already installed that package.");		
		$this->errorText[E_PACKAGE_NOT_FOUND] = t("Invalid Package.");
		$this->errorText[E_PACKAGE_VERSION] = t("This package requires concrete version %s or greater.");
		$this->error = Loader::helper('validation/error');
	}
	
	public function packages() {
		$this->set('nav', 'packages');
		$this->set('pkgArray', Package::getInstalledList());
		$this->set('pkgAvailableArray', Package::getAvailablePackages());
	}
	
	private function mapError($testResults) {
		$testResultsText = array();
		foreach($testResults as $result) {
			if (is_array($result)) {
				$et = $this->errorText[$result[0]];
				array_shift($result);
				$testResultsText[] = vsprintf($et, $result);
			} else {
				$testResultsText[] = $this->errorText[$result];
			}
		}
		return $testResultsText;
	}
	
	public function view() {

	}
	
	public function refresh_block_type($btID = 0) {
		if ($btID > 0) {
			$bt = BlockType::getByID($btID);
		}
		
		if (isset($bt) && ($bt instanceof BlockType)) {
			try {
				if ($bt->getPackageID() > 0) {
					$pkg = Package::getByID($bt->getPackageID());
					$resp = BlockType::installBlockTypeFromPackage($bt->getBlockTypeHandle(), $pkg, $btID);			
					if ($resp != '') {
						throw new Exception($resp);
					}
				} else {
					$resp = BlockType::installBlockType($bt->getBlockTypeHandle(), $btID);			
					if ($resp != '') {
						throw new Exception($resp);
					}
{'fraction_non_alphanumeric': 0.17333763718528084, 'fraction_numerical': 0.002905100064557779, 'mean_word_length': 4.427320490367776, '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': '6955750', 'n_tokens_mistral': 1152, 'n_tokens_neox': 978, 'n_words': 200}