move warehouse directory creation into a single place

This commit is contained in:
Shish
2010-04-23 05:46:07 +01:00
parent ee292c2a25
commit 2c1fa2fd7f
6 changed files with 4 additions and 7 deletions

View File

@ -485,9 +485,11 @@ function format_text($string) {
return $tfe->formatted;
}
function warehouse_path($base, $hash) {
function warehouse_path($base, $hash, $create=true) {
$ab = substr($hash, 0, 2);
return "$base/$ab/$hash";
$pa = "$base/$ab/$hash";
if($create && !file_exists(dirname($pa))) mkdir(dirname($pa), 0755, true);
return $pa;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\