function recommender_create_command in Recommender API 7.4
Same name and namespace in other branches
- 6.3 recommender.module \recommender_create_command()
- 7.3 recommender.module \recommender_create_command()
3 calls to recommender_create_command()
File
- ./
recommender.module, line 151 - Providing generic recommender system algorithms.
Code
function recommender_create_command($app_name, $description = NULL) {
$command = 'RunRecommender';
// FIXME: what if the given $app_name doesn't exist?
$app = recommender_app_load($app_name);
if ($description == NULL) {
$description = t('Compute recommendations: !app', array(
'!app' => $app['title'],
));
}
$app_id = $app['id'];
$execution_id = async_command_create_command('recommender', 'RunRecommender', $description, array(
'id1' => $app_id,
));
if ($execution_id) {
db_query('UPDATE {recommender_app} SET execution_id=:id WHERE name=:name', array(
':id' => $execution_id,
':name' => $app_name,
));
}
drupal_set_message(t('Your request "!description" in the queue. It will be executed asynchronously. Please refresh the page to see the update.', array(
'!description' => $description,
)));
}