You are here

function recommender_app_unregister in Recommender API 7.3

Same name and namespace in other branches
  1. 6.3 recommender.module \recommender_app_unregister()
  2. 7.4 recommender.module \recommender_app_unregister()

Remove the application. Usually used in calling module's hook_uninstall()

Parameters

$apps the application name to be removed.:

Return value

null

1 call to recommender_app_unregister()
rec_example_disable in rec_example/rec_example.install

File

./recommender.module, line 77
Providing generic recommender system algorithms.

Code

function recommender_app_unregister($apps) {
  if (func_num_args() > 1) {
    $apps = func_get_args();

    // if used as recommender_app_unregister('app1', 'app2', ...);
  }
  elseif (!is_array($apps)) {
    $apps = array(
      $apps,
    );

    // if used as recommender_app_unregister('app');
  }

  // finally, used as recommender_app_unregister(array('app1', 'app2', ...);
  foreach ($apps as $app) {
    $app_id = recommender_app_load($app, TRUE);
    db_query("DELETE FROM {recommender_similarity} WHERE app_id=:app_id", array(
      ':app_id' => $app_id,
    ));
    db_query("DELETE FROM {recommender_prediction} WHERE app_id=:app_id", array(
      ':app_id' => $app_id,
    ));
    db_query("DELETE FROM {recommender_app} WHERE id=:app_id", array(
      ':app_id' => $app_id,
    ));
  }
}