<commit_before><?php
/**
 * Call flavor assete setters to migrate from old columns to new custom data fields.
 * After all flavors will be migrated we can remove the columns from the db.
 *
 * @package Deployment
 * @subpackage updates
 */ 

$countLimitEachLoop = 500;

//------------------------------------------------------

require_once(dirname(__FILE__).'/../../bootstrap.php');

$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2);
	
$c = new Criteria();

if (isset($argv[1]))
{
    $c->addAnd(BatchJobPeer::ID, $argv[1], Criteria::GREATER_EQUAL);
}
if (isset($argv[2]))
{
    $c->addAnd(BatchJobPeer::PARTNER_ID, $argv[2], Criteria::EQUAL);
}

$c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::BULKUPLOAD, Criteria::EQUAL);
$c->setLimit($countLimitEachLoop);
$batchJobResults = BatchJobPeer::doSelect($c, $con);

while($batchJobResults && count($batchJobResults))
{
	foreach($batchJobResults as $batchJob)
	{
		/* @var $batchJob BatchJob */
	    $batchJobLog = new BatchJobLog();
		
	    $batchJobLog->setAbort($batchJob->getAbort());
	    $batchJobLog->setBatchIndex($batchJob->getBatchIndex());
	    $batchJobLog->setBulkJobId($batchJob->getBulkJobId());
	    $batchJobLog->setCheckAgainTimeout($batchJob->getCheckAgainTimeout());
	    $batchJobLog->setCreatedAt($batchJob->getCreatedAt());
	    $batchJobLog->setCreatedBy($batchJob->getCreatedBy());
	    $batchJobLog->setData($batchJob->getData());
	    $batchJobLog->setDc($batchJob->getDc());
	    $batchJobLog->setDeletedAt($batchJob->getDeletedAt());
	    $batchJobLog->setDescription($batchJob->getDescription());
	    $batchJobLog->setDuplicationKey($batchJob->getDuplicationKey());
	    $batchJobLog->setEntryId($batchJob->getEntryId());
	    $batchJobLog->setErrNumber($batchJob->getErrNumber());
	    $batchJobLog->setErrType($batchJob->getErrType());
	    $batchJobLog->setExecutionAttempts($batchJob->getExecutionAttempts());
	    $batchJobLog->setFileSize($batchJob->getFileSize());
	    $batchJobLog->setFinishTime($batchJob->getFinishTime());
	    $batchJobLog->setJobId($batchJob->getId());
	    $batchJobLog->setJobSubType($batchJob->getJobSubType());
	    $batchJobLog->setJobType($batchJob->getJobType());
	    $batchJobLog->setLastSchedulerId($batchJob->getLastSchedulerId());
	    $batchJobLog->setLastWorkerId($batchJob->getLastWorkerId());
	    $batchJobLog->setLastWorkerRemote($batchJob->getLastWorkerRemote());
	    $batchJobLog->setLockVersion($batchJob->getLockVersion());
	    $batchJobLog->setMessage($batchJob->getMessage());
	    $batchJobLog->setOnStressDivertTo($batchJob->getOnStressDivertTo());
	    $batchJobLog->setParentJobId($batchJob->getParentJobId());
	    $batchJobLog->setPartnerId($batchJob->getPartnerId());
	    $batchJobLog->setPrimaryKey($batchJob->getPrimaryKey());
	    $batchJobLog->setPriority($batchJob->getPriority());
	    $batchJobLog->setProcessorExpiration($batchJob->getProcessorExpiration());
	    $batchJobLog->setProgress($batchJob->getProgress());
	    $batchJobLog->setQueueTime($batchJob->getQueueTime());
	    $batchJobLog->setRootJobId($batchJob->getRootJobId());
	    $batchJobLog->setSchedulerId($batchJob->getSchedulerId());
	    $batchJobLog->setJobStatus($batchJob->getStatus());
	    $batchJobLog->setSubpId($batchJob->getSubpId());
	    $batchJobLog->setTwinJobId($batchJob->getTwinJobId());
	    $batchJobLog->setUpdatedAt($batchJob->getUpdatedAt());
	    $batchJobLog->setUpdatedBy($batchJob->getUpdatedBy());
	    $batchJobLog->setUpdatesCount($batchJob->getUpdatesCount());
	    $batchJobLog->setWorkerId($batchJob->getWorkerId());
	    $batchJobLog->setWorkGroupId($batchJob->getWorkGroupId());
	    //set param_1 for the $batchJobLog
	    $batchJobData = $batchJob->getData();
	    /* @var $batchJobData kBulkUploadJobData */
	    $batchJobLog->setParam1($batchJobData->getBulkUploadObjectType());
	    
		$batchJob->save();
		
		var_dump("Last handled id: ".$bulkUploadResult->getId());
		
	}
	$countLimitEachLoop += $countLimitEachLoop;
	$c->setOffset($countLimitEachLoop);
	$bulkUploadResults = BulkUploadResultPeer::doSelect($c, $con);
	usleep(100);<commit_msg>fwr: fix for reference to BulkUploadResultPeer<commit_after><?php
/**
 * Call flavor assete setters to migrate from old columns to new custom data fields.
 * After all flavors will be migrated we can remove the columns from the db.
 *
 * @package Deployment
 * @subpackage updates
 */ 

$countLimitEachLoop = 500;

//------------------------------------------------------

require_once(dirname(__FILE__).'/../../bootstrap.php');

$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2);
	
$c = new Criteria();

if (isset($argv[1]))
{
    $c->addAnd(BatchJobPeer::ID, $argv[1], Criteria::GREATER_EQUAL);
}
if (isset($argv[2]))
{
    $c->addAnd(BatchJobPeer::PARTNER_ID, $argv[2], Criteria::EQUAL);
}

$c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::BULKUPLOAD, Criteria::EQUAL);
$c->setLimit($countLimitEachLoop);
$batchJobResults = BatchJobPeer::doSelect($c, $con);

while($batchJobResults && count($batchJobResults))
{
	foreach($batchJobResults as $batchJob)
	{
		/* @var $batchJob BatchJob */
	    $batchJobLog = new BatchJobLog();
		
	    $batchJobLog->setAbort($batchJob->getAbort());
	    $batchJobLog->setBatchIndex($batchJob->getBatchIndex());
	    $batchJobLog->setBulkJobId($batchJob->getBulkJobId());
	    $batchJobLog->setCheckAgainTimeout($batchJob->getCheckAgainTimeout());
	    $batchJobLog->setCreatedAt($batchJob->getCreatedAt());
	    $batchJobLog->setCreatedBy($batchJob->getCreatedBy());
	    $batchJobLog->setData($batchJob->getData());
	    $batchJobLog->setDc($batchJob->getDc());
	    $batchJobLog->setDeletedAt($batchJob->getDeletedAt());
	    $batchJobLog->setDescription($batchJob->getDescription());
	    $batchJobLog->setDuplicationKey($batchJob->getDuplicationKey());
	    $batchJobLog->setEntryId($batchJob->getEntryId());
	    $batchJobLog->setErrNumber($batchJob->getErrNumber());
	    $batchJobLog->setErrType($batchJob->getErrType());
	    $batchJobLog->setExecutionAttempts($batchJob->getExecutionAttempts());
	    $batchJobLog->setFileSize($batchJob->getFileSize());
	    $batchJobLog->setFinishTime($batchJob->getFinishTime());
	    $batchJobLog->setJobId($batchJob->getId());
	    $batchJobLog->setJobSubType($batchJob->getJobSubType());
	    $batchJobLog->setJobType($batchJob->getJobType());
	    $batchJobLog->setLastSchedulerId($batchJob->getLastSchedulerId());
	    $batchJobLog->setLastWorkerId($batchJob->getLastWorkerId());
	    $batchJobLog->setLastWorkerRemote($batchJob->getLastWorkerRemote());
	    $batchJobLog->setLockVersion($batchJob->getLockVersion());
	    $batchJobLog->setMessage($batchJob->getMessage());
	    $batchJobLog->setOnStressDivertTo($batchJob->getOnStressDivertTo());
	    $batchJobLog->setParentJobId($batchJob->getParentJobId());
	    $batchJobLog->setPartnerId($batchJob->getPartnerId());
	    $batchJobLog->setPrimaryKey($batchJob->getPrimaryKey());
	    $batchJobLog->setPriority($batchJob->getPriority());
	    $batchJobLog->setProcessorExpiration($batchJob->getProcessorExpiration());
	    $batchJobLog->setProgress($batchJob->getProgress());
	    $batchJobLog->setQueueTime($batchJob->getQueueTime());
	    $batchJobLog->setRootJobId($batchJob->getRootJobId());
	    $batchJobLog->setSchedulerId($batchJob->getSchedulerId());
	    $batchJobLog->setJobStatus($batchJob->getStatus());
	    $batchJobLog->setSubpId($batchJob->getSubpId());
	    $batchJobLog->setTwinJobId($batchJob->getTwinJobId());
	    $batchJobLog->setUpdatedAt($batchJob->getUpdatedAt());
	    $batchJobLog->setUpdatedBy($batchJob->getUpdatedBy());
	    $batchJobLog->setUpdatesCount($batchJob->getUpdatesCount());
	    $batchJobLog->setWorkerId($batchJob->getWorkerId());
	    $batchJobLog->setWorkGroupId($batchJob->getWorkGroupId());
	    //set param_1 for the $batchJobLog
	    $batchJobData = $batchJob->getData();
	    /* @var $batchJobData kBulkUploadJobData */
	    $batchJobLog->setParam1($batchJobData->getBulkUploadObjectType());
	    
		$batchJob->save();
		
		var_dump("Last handled id: ".$batchJob->getId());
		
	}
	$countLimitEachLoop += $countLimitEachLoop;
	$c->setOffset($countLimitEachLoop);
	$batchJobResults = BatchJobPeer::doSelect($c, $con);
	usleep(100);
{'fraction_non_alphanumeric': 0.18339184118145502, 'fraction_numerical': 0.003147318726546423, 'mean_word_length': 5.5675675675675675, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 195, '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': '6079634', 'n_tokens_mistral': 2750, 'n_tokens_neox': 2603, 'n_words': 274}