function filefield_paths_update_5103 in File (Field) Paths 5
File
- ./
filefield_paths.install, line 184
Code
function filefield_paths_update_5103() {
variable_set('filefield_paths_schema_version', 5103);
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("ALTER TABLE {files} ADD COLUMN origname varchar(255) NOT NULL default ''");
break;
case 'pgsql':
db_add_column($ret = array(), 'files', 'origname', 'varchar(255)', array(
'not null' => TRUE,
'default' => '',
));
break;
}
$result = db_query("SELECT fid, filename FROM {files}");
while ($file = db_fetch_object($result)) {
db_query("UPDATE {files} SET origname = '%s' WHERE fid = %d", $file->filename, $file->fid);
}
return array();
}