build warehouse directories on demand
This commit is contained in:
parent
d0d3e72b74
commit
7a5be72cbd
@ -8,6 +8,7 @@
|
|||||||
class FlashFileHandler extends DataHandlerExtension {
|
class FlashFileHandler extends DataHandlerExtension {
|
||||||
protected function create_thumb($hash) {
|
protected function create_thumb($hash) {
|
||||||
// FIXME: scale image, as not all boards use 192x192
|
// FIXME: scale image, as not all boards use 192x192
|
||||||
|
mkdir(dirname(warehouse_path("thumbs", $hash)), 0755, true);
|
||||||
copy("ext/handle_flash/thumb.jpg", warehouse_path("thumbs", $hash));
|
copy("ext/handle_flash/thumb.jpg", warehouse_path("thumbs", $hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +99,7 @@ class IcoFileHandler extends SimpleExtension {
|
|||||||
$q = $config->get_int("thumb_quality");
|
$q = $config->get_int("thumb_quality");
|
||||||
$mem = $config->get_int("thumb_max_memory") / 1024 / 1024; // IM takes memory in MB
|
$mem = $config->get_int("thumb_max_memory") / 1024 / 1024; // IM takes memory in MB
|
||||||
|
|
||||||
|
mkdir(dirname($outname), 0755, true);
|
||||||
if($config->get_bool("ico_convert")) {
|
if($config->get_bool("ico_convert")) {
|
||||||
// "-limit memory $mem" broken?
|
// "-limit memory $mem" broken?
|
||||||
exec("convert {$inname}[0] -geometry {$w}x{$h} -quality {$q} jpg:$outname");
|
exec("convert {$inname}[0] -geometry {$w}x{$h} -quality {$q} jpg:$outname");
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
class MP3FileHandler extends DataHandlerExtension {
|
class MP3FileHandler extends DataHandlerExtension {
|
||||||
protected function create_thumb($hash) {
|
protected function create_thumb($hash) {
|
||||||
// FIXME: scale image, as not all boards use 192x192
|
// FIXME: scale image, as not all boards use 192x192
|
||||||
|
mkdir(dirname(warehouse_path("thumbs", $hash)), 0755, true);
|
||||||
copy("ext/handle_mp3/thumb.jpg", warehouse_path("thumbs", $hash));
|
copy("ext/handle_mp3/thumb.jpg", warehouse_path("thumbs", $hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ class SVGFileHandler implements Extension {
|
|||||||
// }
|
// }
|
||||||
// else {
|
// else {
|
||||||
// FIXME: scale image, as not all boards use 192x192
|
// FIXME: scale image, as not all boards use 192x192
|
||||||
|
mkdir(dirname(warehouse_path("thumbs", $hash)), 0755, true);
|
||||||
copy("ext/handle_svg/thumb.jpg", warehouse_path("thumbs", $hash));
|
copy("ext/handle_svg/thumb.jpg", warehouse_path("thumbs", $hash));
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
@ -949,6 +949,7 @@ class Tag {
|
|||||||
*/
|
*/
|
||||||
function move_upload_to_archive($event) {
|
function move_upload_to_archive($event) {
|
||||||
$target = warehouse_path("images", $event->hash);
|
$target = warehouse_path("images", $event->hash);
|
||||||
|
mkdir(dirname($target), 0755, true);
|
||||||
if(!@copy($event->tmpname, $target)) {
|
if(!@copy($event->tmpname, $target)) {
|
||||||
throw new UploadException("Failed to copy file from uploads ({$event->tmpname}) to archive ($target)");
|
throw new UploadException("Failed to copy file from uploads ({$event->tmpname}) to archive ($target)");
|
||||||
return false;
|
return false;
|
||||||
|
@ -48,6 +48,7 @@ class PixelFileHandler extends DataHandlerExtension {
|
|||||||
|
|
||||||
$ok = false;
|
$ok = false;
|
||||||
|
|
||||||
|
mkdir(dirname($outname), 0755, true);
|
||||||
switch($config->get_string("thumb_engine")) {
|
switch($config->get_string("thumb_engine")) {
|
||||||
default:
|
default:
|
||||||
case 'gd':
|
case 'gd':
|
||||||
|
30
install.php
30
install.php
@ -149,9 +149,9 @@ function begin() { // {{{
|
|||||||
EOD;
|
EOD;
|
||||||
} // }}}
|
} // }}}
|
||||||
function install_process($database_dsn) { // {{{
|
function install_process($database_dsn) { // {{{
|
||||||
|
build_dirs();
|
||||||
create_tables($database_dsn);
|
create_tables($database_dsn);
|
||||||
insert_defaults($database_dsn);
|
insert_defaults($database_dsn);
|
||||||
build_dirs();
|
|
||||||
write_config($database_dsn);
|
write_config($database_dsn);
|
||||||
|
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
@ -266,34 +266,26 @@ function insert_defaults($dsn) { // {{{
|
|||||||
}
|
}
|
||||||
} // }}}
|
} // }}}
|
||||||
function build_dirs() { // {{{
|
function build_dirs() { // {{{
|
||||||
if(!file_exists("images")) @mkdir("images"); // *try* and make default dirs. Ignore any errors --
|
// *try* and make default dirs. Ignore any errors --
|
||||||
if(!file_exists("thumbs")) @mkdir("thumbs"); // if something is amiss, we'll tell the user later
|
// if something is amiss, we'll tell the user later
|
||||||
if(!file_exists("data")) @mkdir("data");
|
if(!file_exists("images")) @mkdir("images");
|
||||||
|
if(!file_exists("thumbs")) @mkdir("thumbs");
|
||||||
|
if(!file_exists("data") ) @mkdir("data");
|
||||||
|
if(!is_writable("images")) @chmod("images", 0755);
|
||||||
|
if(!is_writable("thumbs")) @chmod("thumbs", 0755);
|
||||||
|
if(!is_writable("data") ) @chmod("data", 0755);
|
||||||
|
|
||||||
if(
|
if(
|
||||||
((!file_exists("images") || !file_exists("thumbs") || !file_exists("data")) && !is_writable("./")) ||
|
!file_exists("images") || !file_exists("thumbs") || !file_exists("data") ||
|
||||||
(!is_writable("images") || !is_writable("thumbs") || !is_writable("data"))
|
!is_writable("images") || !is_writable("thumbs") || !is_writable("data")
|
||||||
) {
|
) {
|
||||||
print "Shimmie needs three folders in it's directory, 'images', 'thumbs', and 'data',
|
print "Shimmie needs three folders in it's directory, 'images', 'thumbs', and 'data',
|
||||||
and they need to be writable by the PHP user (if you see this error,
|
and they need to be writable by the PHP user (if you see this error,
|
||||||
if probably means the folders are owned by you, and they need to be
|
if probably means the folders are owned by you, and they need to be
|
||||||
writable by the web server).
|
writable by the web server).
|
||||||
|
|
||||||
<p>Once you have created these folders, hit 'refresh' to continue.";
|
<p>Once you have created these folders, hit 'refresh' to continue.";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
assert(file_exists("images") && is_writable("images"));
|
|
||||||
assert(file_exists("thumbs") && is_writable("thumbs"));
|
|
||||||
assert(file_exists("data") && is_writable("data"));
|
|
||||||
|
|
||||||
if(!file_exists("images/ff")) {
|
|
||||||
for($i=0; $i<256; $i++) {
|
|
||||||
mkdir(sprintf("images/%02x", $i));
|
|
||||||
mkdir(sprintf("thumbs/%02x", $i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // }}}
|
} // }}}
|
||||||
function write_config($dsn) { // {{{
|
function write_config($dsn) { // {{{
|
||||||
$file_content = "<?php \$database_dsn='$dsn'; ?>";
|
$file_content = "<?php \$database_dsn='$dsn'; ?>";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user