Closed (fixed)
Project:
Transliteration
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 May 2012 at 07:52 UTC
Updated:
15 Jun 2012 at 08:31 UTC
Currently the module allows conversion of new filenames to lower-case.
There is also an option to transliterate existing filenames, but this doesn't change their case.
I want all filenames to be lower-case so as a quick work-around I edited function transliteration_file_query in transliteration.admin.inc, changing
$operator = 'NOT REGEXP';
to
$operator = 'NOT REGEXP BINARY';
The problem is that by default, MySQL's "REGEXP is not case sensitive, except when used with binary strings." (see http://dev.mysql.com/doc/refman/5.1/en/regexp.html). Adding the 'BINARY' makes it case sensitive.
Comments
Comment #1
amateescu commentedResearch checks out on Drupal 6, couldn't reproduce on Drupal 7.14 though, but I committed the same patch to both 6.x-3.x and 7.x-3.x anyway. Thanks for finding this issue and providing a simple solution for it :)
http://drupalcode.org/project/transliteration.git/commit/4307b0b
http://drupalcode.org/project/transliteration.git/commit/f32017f
Comment #2
davidhk commentedMine was a quick hack, but for the real patch will there need to be a check to see whether the user has ticked the "Lowercase transliterated file names." box?
Comment #3
amateescu commentedThat check is happening in transliteration_retroactive_submit() L:86
$filename = transliteration_clean_filename(basename($file->uri));. This 'hack' was only about getting all potential filenames from the db, right?Comment #4
davidhk commentedBut up in transliteration_retroactive(), it uses the query to decide whether there are any filenames that need transliterating.
On a mixed-case filesystem, if there are any filenames with upper-case letters the "$operator = 'NOT REGEXP BINARY'; " will show to the user that there are filenames that need transliterating. If they then click the button to transliterate, the check in transliteration_clean_filename(basename($file->uri)) means nothing will be done.
Might be confusing for the user?
Comment #5
amateescu commentedThat's what I thought as well after posting my previous comment. I'll fix this in a couple of days if you don't beat me to it with a patch :)
Comment #6
amateescu commentedCommitted these follow-up patches to 7.x-3.x and 6.x-3.x.
http://drupalcode.org/project/transliteration.git/commit/5a23ce9
http://drupalcode.org/project/transliteration.git/commit/19fb560