<commit_before><?php

$installedVersion=OCP\Config::getAppValue('contacts', 'installed_version');
if (version_compare($installedVersion, '0.2.90', '<')) {
	// First set all address books in-active.
	$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_addressbooks SET active=0' );
	$result = $stmt->execute(array());
	
	// Then get all the active address books.
	$stmt = OCP\DB::prepare( 'SELECT userid,configvalue FROM *PREFIX*preferences WHERE appid=\'contacts\' AND configkey=\'openaddressbooks\'' );
	$result = $stmt->execute(array());
	
	// Prepare statement for updating the new 'active' field.
	$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_addressbooks SET active=? WHERE id=? AND userid=?' );
	while( $row = $result->fetchRow()) {
		$ids = explode(';', $row['configvalue']);
		foreach($ids as $id) {
			$r = $stmt->execute(array(1, $id, $row['userid']));
		}
	}
	
	// Remove the old preferences.
	$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE appid=\'contacts\' AND configkey=\'openaddressbooks\'' );
	$result = $stmt->execute(array());
}<commit_msg>Wrong version comparison in update.php.<commit_after><?php

$installedVersion=OCP\Config::getAppValue('contacts', 'installed_version');
if (version_compare($installedVersion, '0.2.3', '<')) {
	// First set all address books in-active.
	$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_addressbooks SET active=0' );
	$result = $stmt->execute(array());
	
	// Then get all the active address books.
	$stmt = OCP\DB::prepare( 'SELECT userid,configvalue FROM *PREFIX*preferences WHERE appid=\'contacts\' AND configkey=\'openaddressbooks\'' );
	$result = $stmt->execute(array());
	
	// Prepare statement for updating the new 'active' field.
	$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_addressbooks SET active=? WHERE id=? AND userid=?' );
	while( $row = $result->fetchRow()) {
		$ids = explode(';', $row['configvalue']);
		foreach($ids as $id) {
			$r = $stmt->execute(array(1, $id, $row['userid']));
		}
	}
	
	// Remove the old preferences.
	$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE appid=\'contacts\' AND configkey=\'openaddressbooks\'' );
	$result = $stmt->execute(array());
}
{'fraction_non_alphanumeric': 0.18781493357764545, 'fraction_numerical': 0.005038937242327073, 'mean_word_length': 5.257879656160458, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '2468254', 'n_tokens_mistral': 741, 'n_tokens_neox': 712, 'n_words': 174}