Changed references to /tmp to sys_get_temp_dir

This commit is contained in:
Matthew Barbour 2020-06-16 18:18:56 -05:00 committed by Shish
parent c1068f1b2b
commit fc3c6625bd
5 changed files with 7 additions and 6 deletions

View file

@ -271,7 +271,7 @@ class DanbooruApi extends Extension
}
} elseif (isset($_REQUEST['source']) || isset($_REQUEST['post']['source'])) { // A url was provided
$source = isset($_REQUEST['source']) ? $_REQUEST['source'] : $_REQUEST['post']['source'];
$file = tempnam("/tmp", "shimmie_transload");
$file = tempnam(sys_get_temp_dir(), "shimmie_transload");
$ok = transload($source, $file);
if (!$ok) {
$page->set_code(409);

View file

@ -364,7 +364,7 @@ class Media extends Extension
}
$inname = warehouse_path(Image::IMAGE_DIR, $hash);
$tmpname = tempnam("/tmp", "shimmie_ffmpeg_thumb");
$tmpname = tempnam(sys_get_temp_dir(), "shimmie_ffmpeg_thumb");
$outname = warehouse_path(Image::THUMBNAIL_DIR, $hash);
$orig_size = self::video_size($inname);

View file

@ -475,7 +475,7 @@ class OuroborosAPI extends Extension
) !== false
) {
// Transload from source
$meta['file'] = tempnam('/tmp', 'shimmie_transload_' . $config->get_string('transload_engine'));
$meta['file'] = tempnam(sys_get_temp_dir(), 'shimmie_transload_' . $config->get_string(UploadConfig::TRANSLOAD_ENGINE));
$meta['filename'] = basename($post->file_url);
if (!transload($post->file_url, $meta['file'])) {
$this->sendResponse(500, 'Transloading failed');

View file

@ -198,7 +198,7 @@ class ResizeImage extends Extension
list($new_height, $new_width) = $this->calc_new_size($image_obj, $width, $height);
/* Temp storage while we resize */
$tmp_filename = tempnam("/tmp", 'shimmie_resize');
$tmp_filename = tempnam(sys_get_temp_dir(), 'shimmie_resize');
if (empty($tmp_filename)) {
throw new ImageResizeException("Unable to save temporary image file.");
}

View file

@ -308,7 +308,7 @@ class TranscodeImage extends Extension
$q = $config->get_int("transcode_quality");
$tmp_name = tempnam("/tmp", "shimmie_transcode");
$tmp_name = tempnam(sys_get_temp_dir(), "shimmie_transcode");
$image = imagecreatefromstring(file_get_contents($source_name));
try {
@ -383,7 +383,8 @@ class TranscodeImage extends Extension
$bg = "black";
break;
}
$tmp_name = tempnam("/tmp", "shimmie_transcode");
$tmp_name = tempnam(sys_get_temp_dir(), "shimmie_transcode");
$source_type = "";
switch ($source_format) {