[Mediawiki-l] Safe mode

John Yu jyu at objectmastery.com
Tue Feb 8 23:17:54 UTC 2005


Doesn't v1.4 has a new feature to use a flat directory for file uploading?

Brion Vibber wrote:

> 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:
>   thumb
>   archive
>   temp
> 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:
>   N/NM
> 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)
>MediaWiki-l mailing list
>MediaWiki-l at Wikimedia.org

John Yu
ObjectMastery Pty. Ltd.
Level 4, 854 Glenferrie Road, Hawthorn 3122, Australia.
Tel: (+613) 8862 3222   Fax: (+613) 9818 7867 

More information about the MediaWiki-l mailing list