Skip to content

Commit

Permalink
perf: use single putenv call for exiftool
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <[email protected]>
  • Loading branch information
pulsejet committed Oct 13, 2024
1 parent 70d519d commit 86707ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 0 additions & 2 deletions lib/Exif.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,6 @@ public static function getExifWithDuplicates(string $path): array

private static function getExiftool(): array
{
putenv('LANG=C'); // set perl lang to suppress warning

return BinExt::getExiftool();
}

Expand Down
8 changes: 8 additions & 0 deletions lib/Service/BinExt.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class BinExt
public const GOVOD_VER = '0.2.5';
public const NX_VER_MIN = '1.1';

/** Exiftool environment is initialized in this process */
private static bool $hasExiftoolEnv = false;

/** Get the path to the temp directory */
public static function getTmpPath(): string
{
Expand Down Expand Up @@ -117,6 +120,11 @@ public static function getExiftoolPBin(): string
*/
public static function getExiftool(): array
{
if (!self::$hasExiftoolEnv) {
self::$hasExiftoolEnv = true;
putenv('LANG=C'); // set perl lang to suppress warning
}

if (SystemConfig::get('memories.exiftool_no_local')) {
return ['perl', realpath(__DIR__.'/../../bin-ext/exiftool/exiftool')];
}
Expand Down

0 comments on commit 86707ed

Please sign in to comment.