[Mediawiki-l] Safely change upload directory path without breaking old links

Tech Geek techgeek12345 at gmail.com
Mon Oct 11 20:29:51 UTC 2010


I am using MediaWiki 1.12 installed on Linux machine.

We have been using MediaWiki for over a year with the file upload variables
set to their default values.  Here is what the current mediawiki image
folder looks like:
wikiserver:~# ls /var/www/wiki/images
0  2  4  6  8  a        b  d        e  gnuplot  thumb
1  3  5  7  9  archive  c  deleted  f  temp

Now we need to change upload directory path to something more generic like
"uploads" with the hash strcture instead of "images" directory.

I created the "uploads" directory and set the proper permission to it:
 wikiserver:~#  ls -l /var/www/wiki/
total 116
lrwxrwxrwx 1 root root    36 2010-09-03 18:02 AdminSettings.php ->
/var/lib/mediawiki/AdminSettings.php
-rw-r--r-- 1 root root  2937 2008-03-20 15:09 api.php
lrwxrwxrwx 1 root root    25 2010-03-09 17:27 config ->
/var/lib/mediawiki/config
lrwxrwxrwx 1 root root    29 2010-03-09 17:27 extensions ->
/var/lib/mediawiki/extensions
lrwxrwxrwx 1 root root    25 2010-03-09 17:27 images ->
/var/lib/mediawiki/images
-rw-r--r-- 1 root root  3176 2010-04-17 15:21 img_auth.php
drwxr-xr-x 9 root root 24576 2010-09-03 18:03 includes
-rw-r--r-- 1 root root  3260 2008-03-20 15:09 index.php
-rw-r--r-- 1 root root  3782 2008-03-20 15:09 install-utils.inc
drwxr-xr-x 4 root root  4096 2010-09-03 18:03 languages
lrwxrwxrwx 1 root root    36 2010-09-03 18:02 LocalSettings.php ->
/var/lib/mediawiki/LocalSettings.php
drwxr-xr-x 8 root root 16384 2010-09-03 18:03 maintenance
-rw-r--r-- 1 root root  1483 2008-03-20 15:09 opensearch_desc.php
-rw-r--r-- 1 root root  6580 2010-04-17 15:21 profileinfo.php
-rw-r--r-- 1 root root   289 2008-03-20 15:09 redirect.php
-rw-r--r-- 1 root root    91 2008-03-20 15:09 redirect.phtml
drwxr-xr-x 9 root root  4096 2010-09-03 18:03 skins
-rw-r--r-- 1 root root   603 2008-03-20 15:09 StartProfiler.php
-rw-r--r-- 1 root root 12822 2008-03-20 15:09 Test.php
-rw-r--r-- 1 root root  4012 2010-04-17 15:21 thumb.php
-rw-r--r-- 1 root root  1371 2008-03-20 15:09 trackback.php
lrwxrwxrwx 1 root root    27 2010-10-07 18:10 uploads ->
/var/lib/mediawiki/uploads/
-rw-r--r-- 1 root root    88 2008-03-20 15:09 wiki.phtml

Now I am thinking to have the following in my LocalSettings.php file:
$wgUploadPath = "{$wgScriptPath}/uploads";
$wgUploadDirectory = "{$IP}/uploads/";
$wgHashedUploadDirectory = false;

So far everything looks good and the new files uploaded will work just fine.

Now my question (s):
What about the links/path to the files that have been upload previously? I
am guessing that those will break since they reside in
/var/lib/mediawiki/images directory. Do I need to move them to the new
upload directory /var/lib/mediawiki/uploads ? What about the existing
articles that link to those files in the images directory? Is there a script
which will do the automated image link building?

Thanks


More information about the MediaWiki-l mailing list