Meta:Tools/Wiki conversions/DocBook to Wiki/Uploading images

提供: wiki
移動先: 案内検索

from #mediawiki:

<Inktvlek> is there any logic in the subdirs in "upload/" ?
<Duesentrieb> Inktvlek: the names of the subdirs are derived from an md5 checksum of the file name.
<Inktvlek> so can I externally upload images to the server?
<Duesentrieb> Inktvlek: well, you can upload them vis FTP or so, but MediaWiki won't know about them. You would have to create the appropriate entries in the database too.
<Duesentrieb> best write a script to fill the image table, and create the respective pages in the image namespace, too.
<Duesentrieb> Inktvlek: or you could enable external images. You would then be able to directly include images from anywhere, including some place on your server.
<Duesentrieb> I'm not supre about the details (syntax, etc) though
<Inktvlek> would it be easier to write a script that uses the upload page?
<Inktvlek> a bot rather
<Duesentrieb> you meight be able to mis-use that feature... but that would probably require some hacking.
<Duesentrieb> Inktvlek: easier, yes, especially as there are already bots for that (pybot has an upload feature, for instance)
<Duesentrieb> but it would also be a lot slower.
<Inktvlek> Duesentrieb, one last question (I realised that the actual script you proposed we should write is not *that* hard to write), is the md5 derived sub-dir really necessary?
<Duesentrieb> Inktvlek: no, not unless you have soo many files that the file system would refuse to put them in a sinlge directory.
<Duesentrieb> There's an option for a "flat" structure somewhere... at least there was.
<Duesentrieb> yea, there it is:
<Duesentrieb> $wgHashedUploadDirectory= false;
<Duesentrieb> Inktvlek: have a look at
<Duesentrieb> Inktvlek: here's an upload script (perl):
<Duesentrieb> that would proably be the easiest way...
<Inktvlek> You're the man! Thank you!