[Mediawiki-l] Safe mode
brion at pobox.com
Tue Feb 8 20:27:19 UTC 2005
Lorenzo Breda wrote:
> On my website I must have the SafeMode on. Is there a way to upload
> files with the SafeMode on?
Unless file uploads have also been disabled in your PHP configuration,
then yes. But you have to go to some extra effort.
In safe mode, your PHP scripts can't write to directories that are not
owned by the user account that owns the script, and this creates the
main problem with uploads.
MediaWiki uses subdirectories in the upload area for generated
thumbnails and to temporarily hold files for confirmation. Additionally,
it divides up uploaded files into subdirectories based on the MD5 hash
of the filename. This keeps the individual directories smaller and
relatively manageable (remember MediaWiki was created for Wikipedia,
which is a relatively large site). These subdirectories are created when
they are needed, which usually means they are owned by the 'nobody'
account or the web server's limited user ('web' or 'www' or 'apache'
etc). Thus once the subdirectory is created, it can't actually put files in!
To work around this, you have to create the subdirectories in images/
ahead of time, as your own account:
For the numbered hash subdirectories, you can either create them all or
you can disable the subdivision and let all files go into one place.
(This is not supported on 1.3 unless you backport the change; it is
available in 1.4beta.) To skip turn it off, set $wgHashedUploadDirectory
= false in your LocalSettings.php.
To create them manually, they go in the pattern:
where N and M are each hexadecimal number 0-f. You should end up with 16
top level subdirectories and 256 second-level subdirectories. Create
these in each of images, images/thumb, images/archive, and images/temp.
-- brion vibber (brion @ pobox.com)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 253 bytes
Desc: OpenPGP digital signature
Url : http://lists.wikimedia.org/pipermail/mediawiki-l/attachments/20050208/7678aaa2/attachment.pgp
More information about the MediaWiki-l