function bueditor_update_6200 in BUEditor 6.2
6.x-1.x to 6.x-2.x Change {bueditor_editors}.librarypath field type from varchar to text. It now stores file paths rather than a directory path.
File
- ./
bueditor.install, line 212 - Installs, updates, and uninstalls BUEditor.
Code
function bueditor_update_6200() {
require_once drupal_get_path('module', 'bueditor') . '/bueditor.inc';
$ret = array();
$librarypath = array(
'type' => 'text',
'not null' => TRUE,
);
db_change_field($ret, 'bueditor_editors', 'librarypath', 'librarypath', $librarypath);
//scan library directories for js files and insert them into librarypath field.
$files = array(
'%BUEDITOR/library' => '%BUEDITOR/library/bue.min.default.js',
);
foreach (bueditor_editors('all') as $eid => $editor) {
$dir = $editor->librarypath;
if (!isset($files[$dir])) {
$names = file_scan_directory(bueditor_path_tr($dir), '\\.js$', array(
'.',
'..',
'CVS',
), 0, 0, 'basename');
$files[$dir] = empty($names) ? '' : $dir . '/' . implode("\n{$dir}/", array_keys($names));
}
db_query("UPDATE {bueditor_editors} SET librarypath = '%s' WHERE eid = %d", $files[$dir], $eid);
}
return $ret;
}