binext: allow directory change (fix #821)

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/807/merge
Varun Patil 2023-10-03 11:01:36 -07:00
parent fd13ebd44d
commit d9791d921c
4 changed files with 16 additions and 4 deletions

View File

@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file.
- **Feature**: Shared videos will now be transcoded to be smaller in size
- **Feature**: Confirmation box on deletion ([#798](https://github.com/pulsejet/memories/issues/798))
- **Feature**: Prompt on editing metadata if date will be lost
- **Feature**: Allow changing binary temp directory ([#821](https://github.com/pulsejet/memories/issues/821))
- **Fix**: Support for transcoding MKV files.
## [v5.4.1] - 2023-08-20

View File

@ -12,6 +12,11 @@ class BinExt
public const GOVOD_VER = '0.1.16';
public const NX_VER_MIN = '1.0';
/** Get the path to the temp directory */
public static function getTmpPath(): string {
return Util::getSystemConfig('memories.exiftool.tmp') ?: sys_get_temp_dir();
}
/** Copy a binary to temp dir for execution */
public static function getTempBin(string $path, string $name, bool $copy = true): string
{
@ -19,7 +24,7 @@ class BinExt
$suffix = hash('crc32', $path);
// Check target temp file
$target = sys_get_temp_dir().'/'.$name.'-'.$suffix;
$target = self::getTmpPath().'/'.$name.'-'.$suffix;
if (file_exists($target)) {
if (!is_writable($target)) {
throw new \Exception("{$name} temp binary path is not writable: {$target}");

View File

@ -140,12 +140,12 @@ class Places
echo "Download planet data to temporary file...\n";
flush();
$filename = sys_get_temp_dir().'/planet_coarse_boundaries.zip';
$filename = BinExt::getTmpPath().'/planet_coarse_boundaries.zip';
if (file_exists($filename) && !unlink($filename)) {
throw new \Exception("Failed to delete old planet zip file: {$filename}");
}
$txtfile = sys_get_temp_dir().'/planet_coarse_boundaries.txt';
$txtfile = BinExt::getTmpPath().'/planet_coarse_boundaries.txt';
if (file_exists($txtfile) && !unlink($txtfile)) {
throw new \Exception("Failed to delete old planet data file: {$txtfile}");
}
@ -166,7 +166,7 @@ class Places
$zip = new \ZipArchive();
$res = $zip->open($filename);
if (true === $res) {
$zip->extractTo(sys_get_temp_dir());
$zip->extractTo(BinExt::getTmpPath());
$zip->close();
} else {
throw new \Exception('Failed to unzip planet data file');

View File

@ -8,6 +8,12 @@ return [
// This requires perl to be available
'memories.exiftool_no_local' => false,
// Temporary directory for non-php binaries. The directory must be writable
// and the webserver user should be able to create executable binaries in it.
// Note that go-vod temp files are separately configured (see memories.vod.tempdir)
// Defaults to system temp directory if blank
'memories.exiftool.tmp' => '',
// How to index user directories
// 0 = auto-index disabled
// 1 = index everything