You are here

function filebrowser_update_6202 in Filebrowser 7.3

Same name and namespace in other branches
  1. 6.2 filebrowser.install \filebrowser_update_6202()
  2. 7.4 filebrowser.install \filebrowser_update_6202()
  3. 7.2 filebrowser.install \filebrowser_update_6202()

File

./filebrowser.install, line 238
filbrowser installation file.

Code

function filebrowser_update_6202() {
  $ret = array();

  // Add new fields
  db_add_field($ret, 'filebrowser', 'hidden_files', array(
    'type' => 'varchar',
    'length' => '255',
    'not NULL' => TRUE,
    'default' => '',
  ));
  db_add_field($ret, 'filebrowser', 'filtered_files', array(
    'type' => 'varchar',
    'length' => '255',
    'not NULL' => TRUE,
    'default' => '',
  ));

  // Grab all existing filebrowser data
  $cursor = db_query('SELECT nid, file_blacklist FROM {filebrowser}');
  while ($node = db_fetch_object($cursor)) {
    $hidden = preg_replace("/\\s*,\\s*/", "\r\n", $node->file_blacklist);
    $ret[] = update_sql("update {filebrowser} set hidden_files='" . $hidden . "' where nid=" . $node->nid);
  }

  // Change existing fields
  $ret[] = db_drop_field($ret, 'filebrowser', 'file_blacklist');
  return $ret;
}