You are here

function filebrowser_update_6100 in Filebrowser 7.2

Same name and namespace in other branches
  1. 6.2 filebrowser.install \filebrowser_update_6100()
  2. 6 filebrowser.install \filebrowser_update_6100()
  3. 7.4 filebrowser.install \filebrowser_update_6100()
  4. 7.3 filebrowser.install \filebrowser_update_6100()

File

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

Code

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

  // Add the old directory listing into the new database structure given that
  // this old data exists and users haven't already upgraded manually.
  global $conf;
  if (isset($conf['filebrowser_root']) && !db_table_exists('filebrowser')) {
    db_create_table($ret, 'filebrowser', array(
      'fields' => array(
        'path' => array(
          'type' => 'varchar',
          'length' => '255',
          'not NULL' => TRUE,
        ),
        'location' => array(
          'type' => 'varchar',
          'length' => '255',
          'not NULL' => TRUE,
        ),
        'can_explore' => array(
          'type' => 'int',
          'size' => 'tiny',
          'not NULL' => TRUE,
          'disp-width' => '1',
        ),
      ),
      'primary key' => array(
        'path',
      ),
    ));
    $ret[] = update_sql("INSERT INTO {filebrowser} (path, location, can_explore) VALUES ('filebrowser', '{$conf['filebrowser_root']}', 1)");
  }

  // Clean up variables from 5.x branch
  variable_del('filebrowser_icons');
  variable_del('filebrowser_root');
  variable_del('filebrowser_hide_description_files');
  return $ret;
}