You are here

function apachesolr_mlt_save_block in Apache Solr Search 5

Same name and namespace in other branches
  1. 5.2 apachesolr.admin.inc \apachesolr_mlt_save_block()
  2. 6 apachesolr.admin.inc \apachesolr_mlt_save_block()
  3. 6.2 apachesolr.admin.inc \apachesolr_mlt_save_block()

function apachesolr_mlt_save_block() A helper function save the block data to the database. If passed a valid block id, the function will update block settings in the database. If it is not passed a block id, the function will create a new block.

Parameters

array $block_settings An array containing the settings required to form: a moreLikeThis request.

int $block_id The id of the block you wish to update.:

1 call to apachesolr_mlt_save_block()
apachesolr_mlt_block_form_submit in contrib/apachesolr_mlt/apachesolr_mlt.module
function apachesolr_mlt_block_submit()

File

contrib/apachesolr_mlt/apachesolr_mlt.module, line 316

Code

function apachesolr_mlt_save_block($block_settings = array(), $block_id = 0) {
  if (is_numeric($block_id) && $block_id > 0) {
    db_query("UPDATE {apachesolr_mlt} SET data = '%s' WHERE id = %d", serialize($block_settings), $block_id);
  }
  else {
    db_query("INSERT INTO {apachesolr_mlt} (data) VALUES ('%s')", serialize($block_settings));
  }
}