function filefield_paths_update_6103 in File (Field) Paths 6
Same name and namespace in other branches
- 6.2 filefield_paths.install \filefield_paths_update_6103()
File
- ./
filefield_paths.install, line 182 - Install, update and uninstall functions for the FileField Paths module.
Code
function filefield_paths_update_6103() {
$schema_version = variable_get('filefield_paths_schema_version', '6102');
variable_set('filefield_paths_schema_version', 6103);
if ($schema_version < 5103 || $schema_version > 6000 && $schema_version < 6103) {
db_add_field($ret = array(), 'files', 'origname', array(
'description' => 'Original name of the file.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
));
$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();
}