function tripal_organism_reindex_features
1.x tripal_organism.admin.inc | tripal_organism_reindex_features($organism_id = NULL, $job_id = NULL) |
Related topics
1 string reference to 'tripal_organism_reindex_features'
- tripal_organism_admin_validate in tripal_organism/
includes/ tripal_organism.admin.inc
File
- tripal_organism/
includes/ tripal_organism.admin.inc, line 368
Code
function tripal_organism_reindex_features($organism_id = NULL, $job_id = NULL) {
$i = 0;
if (!$organism_id) {
return;
}
$sql = "SELECT * " .
"FROM {feature} " .
"WHERE organism_id = $organism_id " .
"ORDER BY feature_id";
$results = chado_query($sql);
// load into ids array
$count = 0;
$ids = array();
while ($id = db_fetch_object($results)) {
$ids[$count] = $id->feature_id;
$count++;
}
$interval = intval($count * 0.01);
foreach ($ids as $feature_id) {
// update the job status every 1% features
if ($job_id and $i % $interval == 0) {
tripal_job_set_progress($job_id, intval(($i / $count) * 100));
}
$i++;
}
}