Hi,
(1) Does anyone have a a script that runs through $wgUploadPath and converts the images to a /images/a/ab/foo.jpg structure ?
Someone already asked for this (http://www.mediawiki.org/wiki/Manual_talk:$wgHashedUploadDirectory) and I searched for it in other places.
Reason: My wiki is growing, about 1000 images now and maybe I should act better now than later.
(2) A somewhat related question: Is it difficult to create a "commons wiki" for two existing wikis, simply by following instructions here: http://www.mediawiki.org/wiki/Manual:Wiki_family#Scenario_5:_Multiple_wikis_... and then copy recursively both image directories into the new pool wiki?
I don't care if a few images are overwritten by others with the same name and I also could run the repair script on one wiki to fix wrong dimensions etc.
Another (stupid) solution would be to mass import images from one to each other once in a while (I don't have that many images).
Thanx for any tips ! - Daniel
Daniel K. Schneider wrote:
Hi,
(1) Does anyone have a a script that runs through $wgUploadPath and converts the images to a /images/a/ab/foo.jpg structure ?
Someone already asked for this (http://www.mediawiki.org/wiki/Manual_talk:$wgHashedUploadDirectory) and I searched for it in other places.
Reason: My wiki is growing, about 1000 images now and maybe I should act better now than later.
It's not hard to write. Run this on the image folder:
moveToHashed.php <?php
$hashLevels = 2;
$dir = opendir(".");
while (($file = readdir($dir)) !== false) { if (!is_file($file)) continue; echo "$file\n"; $md5 = md5($file); $hexString = substr($md5, 0, $hashLevels ); $folder = ""; while (strlen($hexString) > 0) { $folder = "$hexString/$folder"; $hexString = substr($hexString, 0, - 1); }
mkdir($folder, 0777, true); rename($file, "$folder$file"); } closedir($dir);
Cool, big many thanx worked like a charm :) - Daniel
Put it here: http://www.mediawiki.org/wiki/Manual_talk:$wgHashedUploadDirectory
Platonides wrote:
It's not hard to write. Run this on the image folder:
moveToHashed.php <?php
$hashLevels = 2;
$dir = opendir(".");
while (($file = readdir($dir)) !== false) { if (!is_file($file)) continue; echo "$file\n"; $md5 = md5($file); $hexString = substr($md5, 0, $hashLevels ); $folder = ""; while (strlen($hexString) > 0) { $folder = "$hexString/$folder"; $hexString = substr($hexString, 0, - 1); }
mkdir($folder, 0777, true); rename($file, "$folder$file"); } closedir($dir);
Oh, it's an answer not showing the question. :-(
2010/4/23 Daniel K. Schneider daniel.schneider@unige.ch
Cool, big many thanx worked like a charm :) - Daniel
Put it here: http://www.mediawiki.org/wiki/Manual_talk:$wgHashedUploadDirectory
Platonides wrote:
It's not hard to write. Run this on the image folder:
moveToHashed.php <?php
$hashLevels = 2;
$dir = opendir(".");
while (($file = readdir($dir)) !== false) { if (!is_file($file)) continue; echo "$file\n"; $md5 = md5($file); $hexString = substr($md5, 0, $hashLevels ); $folder = ""; while (strlen($hexString) > 0) { $folder = "$hexString/$folder"; $hexString = substr($hexString, 0, - 1); }
mkdir($folder, 0777, true); rename($file, "$folder$file");} closedir($dir);
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org