<commit_before><?
/**
 * @access private
 * @package Helpers
 * @category Concrete
 * @author <NAME> <<EMAIL>>
 * @copyright  Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
 * @license    http://www.concrete5.org/license/     MIT License
 */

/**
 * @access private
 * @package Helpers
 * @category Concrete
 * @author <NAME> <<EMAIL>>
 * @copyright  Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
 * @license    http://www.concrete5.org/license/     MIT License
 */

defined('C5_EXECUTE') or die(_("Access Denied."));
class ConcreteUpgradeVersion532Helper {

	protected $numImported = 0;

	protected function incrementImported() {
		$this->numImported++;
		if ($this->numImported > 3000) {
			die("3000 records imported. Please re-run the upgrade script until this message goes away.");
		}
	}
	
	//run before the db.xml changes take place
	public function prepare($cnt) {
		// Handle new attribute stuff
		$db = Loader::db();
		$dict = NewDataDictionary($db->db, DB_TYPE);
		$tables = $db->MetaTables();
		if (!in_array('_UserAttributeKeys', $tables)) {
			$dict->ExecuteSQLArray($dict->RenameTableSQL('UserAttributeKeys', '_UserAttributeKeys'));
			$dict->ExecuteSQLArray($dict->RenameTableSQL('CollectionAttributeKeys', '_CollectionAttributeKeys'));
			$dict->ExecuteSQLArray($dict->RenameTableSQL('FileAttributeKeys', '_FileAttributeKeys'));
			$dict->ExecuteSQLArray($dict->RenameTableSQL('CollectionAttributeValues', '_CollectionAttributeValues'));
			$dict->ExecuteSQLArray($dict->RenameTableSQL('UserAttributeValues', '_UserAttributeValues'));
			$dict->ExecuteSQLArray($dict->RenameTableSQL('FileAttributeValues', '_FileAttributeValues'));
			$dict->ExecuteSQLArray($dict->RenameTableSQL('PageSearchIndexAttributes', '_PageSearchIndexAttributes'));
		}

		$columns = $db->MetaColumns('_UserAttributeValues');
		if (!isset($columns['ISIMPORTED'])) {
			$q = $dict->AddColumnSQL('_UserAttributeValues', 'isImported I1 DEFAULT 0 NULL');
			$db->Execute($q[0]);
			$q = $dict->AddColumnSQL('_FileAttributeValues', 'isImported I1 DEFAULT 0 NULL');
			$db->Execute($q[0]);
			$q = $dict->AddColumnSQL('_CollectionAttributeValues', 'isImported I1 DEFAULT 0 NULL');
			$db->Execute($q[0]);
		} else {
			$cnt->upgrade_db = false;
		}
	}
	
	public function run() {
		Cache::disableLocalCache();
		
		Loader::model('collection_attributes');
		//add the new collection attribute keys
		$this->installCoreAttributeItems();
		$this->upgradeCollectionAttributes();
		$this->upgradeFileAttributes();
		$this->upgradeUserAttributes();

		
		$cak=CollectionAttributeKey::getByHandle('exclude_sitemapxml');
		if (!is_object($cak)) {
			$cak = CollectionAttributeKey::add('exclude_sitemapxml', t('Exclude From sitemap.xml'), true, null, 'BOOLEAN');
		}
		<commit_msg>upgrade stuff<commit_after><?
/**
 * @access private
 * @package Helpers
 * @category Concrete
 * @author <NAME> <<EMAIL>>
 * @copyright  Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
 * @license    http://www.concrete5.org/license/     MIT License
 */

/**
 * @access private
 * @package Helpers
 * @category Concrete
 * @author <NAME> <<EMAIL>>
 * @copyright  Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
 * @license    http://www.concrete5.org/license/     MIT License
 */

defined('C5_EXECUTE') or die(_("Access Denied."));
class ConcreteUpgradeVersion532Helper {

	protected $numImported = 0;

	protected function incrementImported() {
		$this->numImported++;
		if ($this->numImported > 3000) {
			die("3000 records imported. Please re-run the upgrade script until this message goes away.");
		}
	}
	
	//run before the db.xml changes take place
	public function prepare($cnt) {
		// Handle new attribute stuff
		$db = Loader::db();
		$dict = NewDataDictionary($db->db, DB_TYPE);
		$tables = $db->MetaTables();
		if (!in_array('_UserAttributeKeys', $tables)) {
			$dict->ExecuteSQLArray($dict->RenameTableSQL('UserAttributeKeys', '_UserAttributeKeys'));
			$dict->ExecuteSQLArray($dict->RenameTableSQL('CollectionAttributeKeys', '_CollectionAttributeKeys'));
			$dict->ExecuteSQLArray($dict->RenameTableSQL('FileAttributeKeys', '_FileAttributeKeys'));
			$dict->ExecuteSQLArray($dict->RenameTableSQL('CollectionAttributeValues', '_CollectionAttributeValues'));
			$dict->ExecuteSQLArray($dict->RenameTableSQL('UserAttributeValues', '_UserAttributeValues'));
			$dict->ExecuteSQLArray($dict->RenameTableSQL('FileAttributeValues', '_FileAttributeValues'));
			$dict->ExecuteSQLArray($dict->RenameTableSQL('PageSearchIndexAttributes', '_PageSearchIndexAttributes'));
		}

		$columns = $db->MetaColumns('_UserAttributeValues');
		if (!isset($columns['ISIMPORTED'])) {
			$q = $dict->AddColumnSQL('_UserAttributeValues', 'isImported I1 DEFAULT 0 NULL');
			$db->Execute($q[0]);
			$q = $dict->AddColumnSQL('_FileAttributeValues', 'isImported I1 DEFAULT 0 NULL');
			$db->Execute($q[0]);
			$q = $dict->AddColumnSQL('_CollectionAttributeValues', 'isImported I1 DEFAULT 0 NULL');
			$db->Execute($q[0]);
		} else {
			$cnt->upgrade_db = false;
		}
	}
	
	public function run() {
		Cache::disableLocalCache();
		
		Loader::model('collection_attributes');
		//add the new collection attribute keys
		$this->installCoreAttributeItems();
		
		$dict = NewDataDictionary($db->db, DB_TYPE);
		$tables = $db->MetaTables();
		if (in_array('_CollectionAttributeKeys', $tables)) {
			$this->upgradeCollectionAttributes();
		}
		if (in_array('_FileAttributeKeys', $tables)) {
			$this->upgradeFileAttributes();
		}
		if (in_array('_UserAttributeKeys', $tables)) {
			$this->upgradeUserAttributes();
		}

		$cak=CollectionAttributeKey::getByHandle('exclude_sitemapxml');
		if (!is_object($cak)) {
			$cak = CollectionAttributeKey::add('exclude_sitemapxml', t('Exclude From sitemap.xml'), true, null, 'BOOLEAN');
		}
		
{'fraction_non_alphanumeric': 0.1657506011679835, 'fraction_numerical': 0.01511508072827207, 'mean_word_length': 5.491638795986622, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 79, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 8}, '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': '2558680', 'n_tokens_mistral': 1986, 'n_tokens_neox': 1775, 'n_words': 341}