[import] Don't let parallel imports step on each other when making directories.

This commit is contained in:
Solomon Peachy 2012-10-17 06:28:27 -04:00
parent 894e390c1a
commit b1c728756d
3 changed files with 11 additions and 11 deletions

View File

@ -25,6 +25,7 @@ v2.38 (Unreleased)
[fix] Keyword search on the photo page was busted.
[fix] Workaround for bug in JustPictures' RSS queries.
[fix] Fix thumbnail URI in RSS feeds.
[fix] Better handling when importing images in parallel.
2.37 (September 27, 2010)

View File

@ -100,13 +100,14 @@ function get_current_volume($database, $image_file) {
continue;
} else {
/* if the next volume does not exist, try to create it */
if (!mkdir($image_repository_path."/".$new_volume, 0700))
return FALSE;
if (!mkdir($image_repository_path."/".$new_volume."/00000", 0700))
return FALSE;
if (!mkdir($image_repository_path."/".$new_volume."/00001", 0700))
return FALSE;
break;
mkdir($image_repository_path."/".$new_volume."/00000", 0700, TRUE);
mkdir($image_repository_path."/".$new_volume."/00001", 0700, TRUE);
if (($directory_handle = @opendir($image_repository_path."/".$new_volume))) {
closedir($directory_handle);
break;
} else {
return FALSE;
}
}
} while (TRUE);

View File

@ -781,11 +781,9 @@ function po_new_install($database) {
return FALSE;
}
$res = mkdir("$image_repository_path/$first_volume", 0700);
if ($res)
$res = mkdir("$image_repository_path/$first_volume/00000", 0700);
$res = mkdir("$image_repository_path/$first_volume/00000", 0700, TRUE);
if ($res)
$res = mkdir("$image_repository_path/$first_volume/00001", 0700);
$res = mkdir("$image_repository_path/$first_volume/00001", 0700, TRUE);
if ($res)
$res = po_symlink($first_volume, "$image_repository_path/current");