You are here

function recommender_app_register in Recommender API 6.3

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

Register a recommender application. The most important function you would use.

Parameters

$apps See documentation for the parameters.:

Return value

void

1 call to recommender_app_register()
RecommenderTestCase::setUp in ./recommender.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…

File

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

Code

function recommender_app_register($apps) {
  foreach ($apps as $name => $app) {
    $params = serialize($app['params']);
    if (recommender_app_load($name, TRUE)) {

      // app exists, then update
      db_query("UPDATE {recommender_app} SET title = '%s', params = '%s' WHERE name = '%s'", $app['title'], $params, $name);
    }
    else {

      // app not exists, just insert
      db_query("INSERT INTO {recommender_app}(name, title, params) VALUE('%s', '%s', '%s')", $name, $app['title'], $params);
    }
  }
}