function drush_tripal_core_set_user
2.x tripal_core.drush.inc | drush_tripal_core_set_user($username) |
3.x tripal_core.drush.inc | drush_tripal_core_set_user($username) |
Set the user to run a drush job.
Related topics
8 calls to drush_tripal_core_set_user()
- drush_tripal_core_tripal_jobs_launch in tripal_core/
tripal_core.drush.inc - DEPRECATED. Executes jobs in the Tripal Jobs Queue.
- drush_tripal_core_tripal_jobs_rerun in tripal_core/
tripal_core.drush.inc - DEPRECATED. Executes jobs in the Tripal Jobs Queue.
- drush_tripal_core_trp_rerun_job in tripal_core/
tripal_core.drush.inc - Executes jobs in the Tripal Jobs Queue.
- drush_tripal_core_trp_run_jobs in tripal_core/
tripal_core.drush.inc - Executes jobs in the Tripal Jobs Queue.
- drush_tripal_phylogeny_trp_delete_phylotree in tripal_phylogeny/
tripal_phylogeny.drush.inc - Deletes a phylotree record.
File
- tripal_core/
tripal_core.drush.inc, line 275 - Contains function relating to drush-integration of this module.
Code
function drush_tripal_core_set_user($username) {
if ($username) {
$sql = "SELECT uid FROM {users} WHERE name = :name";
$results = db_query($sql, array(':name' => $username));
$u = $results->fetchObject();
if (!$u) {
drush_print('ERROR: Please provide a valid username (--username argument) for running this job.');
exit;
}
global $user;
$user = user_load($u->uid);
return $u->uid;
}
else {
drush_print('ERROR: Please provide a username (--username argument) for running this job.');
exit;
}
}