You are here

function context_prefix_update_2 in Context 5

File

context_prefix/context_prefix.install, line 24

Code

function context_prefix_update_2() {
  $items = array();
  $items[] = update_sql("CREATE TABLE {context_prefix} (space VARCHAR(255) NOT NULL, path VARCHAR(255) NOT NULL, id INT(10) NOT NULL, PRIMARY KEY (path)) /*!40100 DEFAULT CHARACTER SET UTF8 */");
  $paths = variable_get('context_paths', array());
  if ($paths) {
    foreach ($paths as $space => $p) {
      foreach ($p as $path => $nid) {
        db_query("REPLACE INTO {context_prefix} (space, path, id) VALUES('%s', '%s', %d)", $space, $path, $nid);
      }
    }
    variable_del('context_paths');
  }
  return $items;
}