<commit_before><?php

require_once ('apps/designer/lib/Functions.php');

/**
 * Installs an app or theme from an uploaded zip file.
 */
class ZipInstaller extends Installer {
	/**
	 * Requires the entry from $_FILES of a zip file.
	 */
	public static function install ($source) {
		try {
			Zipper::unzip ($source['tmp_name']);
		} catch (Exception $e) {
			self::$error = $e->getMessage();
			return false;
		}

		$folder = Zipper::find_folder ($source);

		// Get config and verify it
		if (! file_exists ($folder . '/elefant.json')) {
			self::$error = __ ('Verification failed: No configuration file found.');
			return false;
		}

		$conf = json_decode (file_get_contents ($folder . '/elefant.json'));
		if ($conf === false) {
			self::$error = __ ('Verification failed: Invalid configuration file.');
			return false;
		}

		if (! self::verify ($conf)) {<commit_msg>Fix for app installer sending array instead of string.<commit_after><?php

require_once ('apps/designer/lib/Functions.php');

/**
 * Installs an app or theme from an uploaded zip file.
 */
class ZipInstaller extends Installer {
	/**
	 * Requires the entry from $_FILES of a zip file.
	 */
	public static function install ($source) {
		try {
			Zipper::unzip ($source['tmp_name']);
		} catch (Exception $e) {
			self::$error = $e->getMessage();
			return false;
		}

		$folder = Zipper::find_folder ($source['name']);

		// Get config and verify it
		if (! file_exists ($folder . '/elefant.json')) {
			self::$error = __ ('Verification failed: No configuration file found.');
			return false;
		}

		$conf = json_decode (file_get_contents ($folder . '/elefant.json'));
		if ($conf === false) {
			self::$error = __ ('Verification failed: Invalid configuration file.');
			return false;
		}

		if (! self::verify ($conf)) {
{'fraction_non_alphanumeric': 0.15783602900167318, 'fraction_numerical': 0.0, 'mean_word_length': 3.6476683937823835, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5540984', 'n_tokens_mistral': 606, 'n_tokens_neox': 546, 'n_words': 170}