Jump to content

Recommended Posts

Posted

I'm having issues with moodle and case-sensitive files on LAMP

 

I received "The National Strategies: Inclusion Development Programme Primary/Secondary" from the dfCSF.

The software is designed for staff inset. Although the software is a windows installer, it is (almost) perfect VLE material - lots of HTML with a few Flash exercises.

 

but in the infinite wisdom of the dfCSF they have coded it with a mix of uppercase and lowercase HTML, looking for uppercase and lowercase files.

They then claim it only works on XP. I can see why.

 

Is there a simple way of making apache case insensitive?

 

I tried a script that changes file/directorynames to lowercase, but it only partially solved the problem. Anyone fancy sharing something sed/perly that will change my href's to something lowercase?

Posted

I tested it on a apache virtualhost which was running on the same server as the moodle, but it did the same, so I suspect it is more apache than moodle.

 

there is a lot of data on our moodle (we've had it for a few years now) and I'm sure that installing mod_rewrite won't work because there are so many files already uploaded, realistically I don't want to rename them all - it's bound to go pear shaped.

Posted (edited)
...mod_spelling now seems to be known as mod_speling...

Apache are taking the p*** aren't they ? :)

Trying to be clevar..

Edited by witch
Posted

I just found this excellent post. I think I'll try an butcher a script....

 

Re: WC:>: changing anchor filenames to lowercase

 

perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html

 

which says:

 

 

perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html

^^^^^^

for every file in this directory whose extension is '.html',

 

 

perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html

^^^^^

create a backup copy (with the extension '.bak'), then write the output of

this command back into the original file. the official term for this is

"in-place editing", hence the 'i'.

 

 

perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html

^^

loop through the file one line at a time, printing the results of the

command (technically, the contents of the "$_" internal variable) before

going on to the next line.

 

 

perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html

^^

decide what to print (and thus write back into the file) by executing the

string which follows. and that string says:

 

 

perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html

^

perform a substitution

 

 

perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html

^

for every occurrence of a matching string (not just the first, as is the

default), which makes this a 'global' search & replace function.

 

 

perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html

^

ignore case when looking for items that match the target pattern.

 

 

perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html

^^^^^^

the pattern we're looking for starts with the string 'href="'

 

 

perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html

^^

followed by any number of characters, of any kind,

 

 

perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html

^^

up to the next '"' mark.

 

 

perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html

^ ^

when you find a string of that type, remember it (store it in a temporary

variable named "$1")

 

 

perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html

^^^^

and replace it with a copy of itself, converted entirely to lowercase.

 

after running that, all your URLs should be converted to lowercase in the

original files, but the backups contain original versions of each file.

if something goes wrong, you can back up and start again. if the command

did what you wanted, you can delete all the backup files and be done with

it.

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...