From 07b710567d393af91453433ce9f76f6e4ed8c2d0 Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Mon, 18 Aug 2025 12:54:13 -0700 Subject: [PATCH] container: fetch: refactor for php - Refactors locations for internal `fetch` impl and deps (composer) * A softer hardcoding without the need for a new autoloader * A restructured solution to silence the linter (phpstan) NOTE: variables are prepended with *_PHP_* as to not bring confusion with any other `dfi` dependencies or the `dfi` `root` module (C++). --- .../lib/internal/fetch/blockchains/fetch.php | 10 +++++----- .../fetch/blockchains/internal/base.php | 4 ++-- .../internal/blockchains/algorand.php | 10 +++++----- .../internal/blockchains/ethereum.php | 8 ++++---- .../internal/blockchains/tezos.php | 10 +++++----- .../lib/internal/fetch/exchanges/fetch.php | 10 +++++----- .../fetch/exchanges/internal/base.php | 6 +++--- .../internal/exchanges/archive/bittrex.php | 10 +++++----- .../internal/exchanges/archive/celsius.php | 10 +++++----- .../exchanges/archive/coinbase-pro.php | 11 +++++------ .../exchanges/internal/exchanges/coinbase.php | 9 ++++----- .../exchanges/internal/exchanges/gemini.php | 9 ++++----- .../src/finance/lib/internal/fetch/fetch.php | 19 ++++++++++++++----- .../lib/internal/fetch/prices/fetch.php | 8 ++++---- .../internal/fetch/prices/internal/base.php | 6 +++--- .../fetch/prices/internal/prices/crypto.php | 10 +++++----- .../lib/internal/fetch/utils/utils.php | 4 +--- .../src/finance/lib/internal/lib_fetch.bash | 12 +++++++++--- 18 files changed, 88 insertions(+), 78 deletions(-) diff --git a/container/src/finance/lib/internal/fetch/blockchains/fetch.php b/container/src/finance/lib/internal/fetch/blockchains/fetch.php index e9eb431..6cc291e 100644 --- a/container/src/finance/lib/internal/fetch/blockchains/fetch.php +++ b/container/src/finance/lib/internal/fetch/blockchains/fetch.php @@ -27,11 +27,11 @@ namespace docker_finance\blockchains { - require_once('blockchains/internal/base.php'); - require_once('blockchains/internal/blockchains/algorand.php'); - require_once('blockchains/internal/blockchains/ethereum.php'); - require_once('blockchains/internal/blockchains/tezos.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'blockchains/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'blockchains/internal/blockchains/algorand.php'); + require_once(__DFI_PHP_ROOT__ . 'blockchains/internal/blockchains/ethereum.php'); + require_once(__DFI_PHP_ROOT__ . 'blockchains/internal/blockchains/tezos.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\utils as utils; diff --git a/container/src/finance/lib/internal/fetch/blockchains/internal/base.php b/container/src/finance/lib/internal/fetch/blockchains/internal/base.php index e8cf26b..b611ff6 100644 --- a/container/src/finance/lib/internal/fetch/blockchains/internal/base.php +++ b/container/src/finance/lib/internal/fetch/blockchains/internal/base.php @@ -27,7 +27,7 @@ namespace docker_finance\blockchains\internal { - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\utils as utils; @@ -266,7 +266,7 @@ namespace docker_finance\blockchains\internal namespace docker_finance\blockchains { - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\utils as utils; diff --git a/container/src/finance/lib/internal/fetch/blockchains/internal/blockchains/algorand.php b/container/src/finance/lib/internal/fetch/blockchains/internal/blockchains/algorand.php index db4e32b..90aba85 100644 --- a/container/src/finance/lib/internal/fetch/blockchains/internal/blockchains/algorand.php +++ b/container/src/finance/lib/internal/fetch/blockchains/internal/blockchains/algorand.php @@ -2,7 +2,7 @@ // docker-finance | modern accounting for the power-user // -// Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC) +// Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,8 +27,8 @@ namespace docker_finance\blockchains\internal\blockchains\algorand { - require_once('blockchains/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'blockchains/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\blockchains\internal as internal; use docker_finance\utils as utils; @@ -270,8 +270,8 @@ namespace docker_finance\blockchains\internal\blockchains\algorand namespace docker_finance\blockchains\internal\blockchains { - require_once('blockchains/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'blockchains/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\blockchains\internal as internal; use docker_finance\utils as utils; diff --git a/container/src/finance/lib/internal/fetch/blockchains/internal/blockchains/ethereum.php b/container/src/finance/lib/internal/fetch/blockchains/internal/blockchains/ethereum.php index 6a34add..66f860c 100644 --- a/container/src/finance/lib/internal/fetch/blockchains/internal/blockchains/ethereum.php +++ b/container/src/finance/lib/internal/fetch/blockchains/internal/blockchains/ethereum.php @@ -27,8 +27,8 @@ namespace docker_finance\blockchains\internal\blockchains\ethereum { - require_once('blockchains/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'blockchains/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\blockchains\internal as internal; use docker_finance\utils as utils; @@ -322,8 +322,8 @@ namespace docker_finance\blockchains\internal\blockchains\ethereum namespace docker_finance\blockchains\internal\blockchains { - require_once('blockchains/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'blockchains/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\blockchains\internal as internal; use docker_finance\utils as utils; diff --git a/container/src/finance/lib/internal/fetch/blockchains/internal/blockchains/tezos.php b/container/src/finance/lib/internal/fetch/blockchains/internal/blockchains/tezos.php index 107ae5b..541e514 100644 --- a/container/src/finance/lib/internal/fetch/blockchains/internal/blockchains/tezos.php +++ b/container/src/finance/lib/internal/fetch/blockchains/internal/blockchains/tezos.php @@ -2,7 +2,7 @@ // docker-finance | modern accounting for the power-user // -// Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC) +// Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,8 +27,8 @@ namespace docker_finance\blockchains\internal\blockchains\tezos { - require_once('blockchains/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'blockchains/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\blockchains\internal as internal; use docker_finance\utils as utils; @@ -265,8 +265,8 @@ namespace docker_finance\blockchains\internal\blockchains\tezos namespace docker_finance\blockchains\internal\blockchains { - require_once('blockchains/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'blockchains/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\blockchains\internal as internal; use docker_finance\utils as utils; diff --git a/container/src/finance/lib/internal/fetch/exchanges/fetch.php b/container/src/finance/lib/internal/fetch/exchanges/fetch.php index 76a9c15..423df17 100644 --- a/container/src/finance/lib/internal/fetch/exchanges/fetch.php +++ b/container/src/finance/lib/internal/fetch/exchanges/fetch.php @@ -2,7 +2,7 @@ // docker-finance | modern accounting for the power-user // -// Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC) +// Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,10 +27,10 @@ namespace docker_finance\exchanges { - require_once('exchanges/internal/base.php'); - require_once('exchanges/internal/exchanges/coinbase.php'); - require_once('exchanges/internal/exchanges/gemini.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'exchanges/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'exchanges/internal/exchanges/coinbase.php'); + require_once(__DFI_PHP_ROOT__ . 'exchanges/internal/exchanges/gemini.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\utils as utils; diff --git a/container/src/finance/lib/internal/fetch/exchanges/internal/base.php b/container/src/finance/lib/internal/fetch/exchanges/internal/base.php index c4137b6..3e06b3c 100644 --- a/container/src/finance/lib/internal/fetch/exchanges/internal/base.php +++ b/container/src/finance/lib/internal/fetch/exchanges/internal/base.php @@ -2,7 +2,7 @@ // docker-finance | modern accounting for the power-user // -// Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC) +// Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ namespace docker_finance\exchanges\internal { - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\utils as utils; @@ -132,7 +132,7 @@ namespace docker_finance\exchanges\internal namespace docker_finance\exchanges { - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\utils as utils; diff --git a/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/archive/bittrex.php b/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/archive/bittrex.php index 4048314..51c8c45 100644 --- a/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/archive/bittrex.php +++ b/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/archive/bittrex.php @@ -2,7 +2,7 @@ // docker-finance | modern accounting for the power-user // -// Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC) +// Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,8 +27,8 @@ namespace docker_finance\exchanges\internal\exchanges\bittrex { - require_once('exchanges/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'exchanges/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\utils as utils; @@ -249,8 +249,8 @@ namespace docker_finance\exchanges\internal\exchanges\bittrex namespace docker_finance\exchanges\internal\exchanges { - require_once('exchanges/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'exchanges/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); /** * @brief Facade for Bittrex implementation diff --git a/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/archive/celsius.php b/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/archive/celsius.php index 9996180..3348133 100644 --- a/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/archive/celsius.php +++ b/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/archive/celsius.php @@ -2,7 +2,7 @@ // docker-finance | modern accounting for the power-user // -// Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC) +// Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,8 +27,8 @@ namespace docker_finance\exchanges\internal\exchanges\celsius { - require_once('exchanges/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'exchanges/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\utils as utils; @@ -170,8 +170,8 @@ namespace docker_finance\exchanges\internal\exchanges\celsius namespace docker_finance\exchanges\internal\exchanges { - require_once('exchanges/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'exchanges/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); /** * @brief Facade for Celsius implementation diff --git a/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/archive/coinbase-pro.php b/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/archive/coinbase-pro.php index 51dcf87..2fedfb9 100644 --- a/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/archive/coinbase-pro.php +++ b/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/archive/coinbase-pro.php @@ -2,7 +2,7 @@ // docker-finance | modern accounting for the power-user // -// Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC) +// Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,9 +27,8 @@ namespace docker_finance\exchanges\internal\exchanges\coinbase_pro { - require_once('php/vendor/autoload.php'); //!< mocking-magician/coinbase-pro-sdk - require_once('exchanges/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'exchanges/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use MockingMagician\CoinbaseProSdk\CoinbaseFacade; use MockingMagician\CoinbaseProSdk\Contracts\Api\ApiInterface; @@ -275,8 +274,8 @@ namespace docker_finance\exchanges\internal\exchanges\coinbase_pro namespace docker_finance\exchanges\internal\exchanges { - require_once('exchanges/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'exchanges/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); /** * @brief Facade for Coinbase Pro implementation diff --git a/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/coinbase.php b/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/coinbase.php index 267cf66..e24556d 100644 --- a/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/coinbase.php +++ b/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/coinbase.php @@ -27,9 +27,8 @@ namespace docker_finance\exchanges\internal\exchanges\coinbase { - require_once('php/vendor/autoload.php'); //!< ccxt - require_once('exchanges/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'exchanges/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\utils as utils; @@ -279,8 +278,8 @@ namespace docker_finance\exchanges\internal\exchanges\coinbase namespace docker_finance\exchanges\internal\exchanges { - require_once('exchanges/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'exchanges/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); /** * @brief Facade for Coinbase implementation diff --git a/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/gemini.php b/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/gemini.php index 98d04f3..99c7f49 100644 --- a/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/gemini.php +++ b/container/src/finance/lib/internal/fetch/exchanges/internal/exchanges/gemini.php @@ -27,9 +27,8 @@ namespace docker_finance\exchanges\internal\exchanges\gemini { - require_once('php/vendor/autoload.php'); //!< ccxt - require_once('exchanges/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'exchanges/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\utils as utils; use DateTime; // PHP @@ -490,8 +489,8 @@ namespace docker_finance\exchanges\internal\exchanges\gemini namespace docker_finance\exchanges\internal\exchanges { - require_once('exchanges/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'exchanges/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); /** * @brief Facade for Gemini implementation diff --git a/container/src/finance/lib/internal/fetch/fetch.php b/container/src/finance/lib/internal/fetch/fetch.php index 16637ed..ebd665e 100644 --- a/container/src/finance/lib/internal/fetch/fetch.php +++ b/container/src/finance/lib/internal/fetch/fetch.php @@ -2,7 +2,7 @@ // docker-finance | modern accounting for the power-user // -// Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC) +// Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -25,12 +25,21 @@ //! @since docker-finance 1.0.0 +namespace { + //! Dependencies (via composer) + define('__DFI_PHP_DEPS__', getenv('__DFI_PHP_DEPS__') . '/'); + require_once(__DFI_PHP_DEPS__ . 'vendor/autoload.php'); + + //! docker-finance `fetch` impl + define('__DFI_PHP_ROOT__', getenv('__DFI_PHP_ROOT__') . '/'); +} + namespace docker_finance { - require_once('blockchains/fetch.php'); - require_once('exchanges/fetch.php'); - require_once('prices/fetch.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'blockchains/fetch.php'); + require_once(__DFI_PHP_ROOT__ . 'exchanges/fetch.php'); + require_once(__DFI_PHP_ROOT__ . 'prices/fetch.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); /** * @brief API executor diff --git a/container/src/finance/lib/internal/fetch/prices/fetch.php b/container/src/finance/lib/internal/fetch/prices/fetch.php index a6f5398..5cf82ce 100644 --- a/container/src/finance/lib/internal/fetch/prices/fetch.php +++ b/container/src/finance/lib/internal/fetch/prices/fetch.php @@ -2,7 +2,7 @@ // docker-finance | modern accounting for the power-user // -// Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC) +// Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,9 +27,9 @@ namespace docker_finance\prices { - require_once('prices/internal/base.php'); - require_once('prices/internal/prices/crypto.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'prices/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'prices/internal/prices/crypto.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\utils as utils; diff --git a/container/src/finance/lib/internal/fetch/prices/internal/base.php b/container/src/finance/lib/internal/fetch/prices/internal/base.php index a4cf021..600462b 100644 --- a/container/src/finance/lib/internal/fetch/prices/internal/base.php +++ b/container/src/finance/lib/internal/fetch/prices/internal/base.php @@ -2,7 +2,7 @@ // docker-finance | modern accounting for the power-user // -// Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC) +// Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ namespace docker_finance\prices\internal { - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\utils as utils; @@ -443,7 +443,7 @@ namespace docker_finance\prices\internal namespace docker_finance\prices { - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\utils as utils; diff --git a/container/src/finance/lib/internal/fetch/prices/internal/prices/crypto.php b/container/src/finance/lib/internal/fetch/prices/internal/prices/crypto.php index 33e93b3..8782019 100644 --- a/container/src/finance/lib/internal/fetch/prices/internal/prices/crypto.php +++ b/container/src/finance/lib/internal/fetch/prices/internal/prices/crypto.php @@ -2,7 +2,7 @@ // docker-finance | modern accounting for the power-user // -// Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC) +// Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,8 +27,8 @@ namespace docker_finance\prices\internal\prices\crypto { - require_once('prices/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'prices/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\prices\internal as internal; use docker_finance\utils as utils; @@ -239,8 +239,8 @@ namespace docker_finance\prices\internal\prices\crypto namespace docker_finance\prices\internal\prices { - require_once('prices/internal/base.php'); - require_once('utils/utils.php'); + require_once(__DFI_PHP_ROOT__ . 'prices/internal/base.php'); + require_once(__DFI_PHP_ROOT__ . 'utils/utils.php'); use docker_finance\utils as utils; diff --git a/container/src/finance/lib/internal/fetch/utils/utils.php b/container/src/finance/lib/internal/fetch/utils/utils.php index 5d64549..086e70c 100644 --- a/container/src/finance/lib/internal/fetch/utils/utils.php +++ b/container/src/finance/lib/internal/fetch/utils/utils.php @@ -2,7 +2,7 @@ // docker-finance | modern accounting for the power-user // -// Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC) +// Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,8 +27,6 @@ namespace docker_finance\utils { - require_once('php/vendor/autoload.php'); //!< JsonCsv - /** * @brief Environment mapper * @details From CLI<->PHP diff --git a/container/src/finance/lib/internal/lib_fetch.bash b/container/src/finance/lib/internal/lib_fetch.bash index 608940a..4b5cca7 100644 --- a/container/src/finance/lib/internal/lib_fetch.bash +++ b/container/src/finance/lib/internal/lib_fetch.bash @@ -833,7 +833,13 @@ function lib_fetch::__fetch_exec() [ -z "$_type" ] && lib_utils::die_fatal [ -z "$_subtype" ] && lib_utils::die_fatal - local _dir="${DOCKER_FINANCE_CONTAINER_REPO}/src/finance/lib/internal/fetch" + # `fetch` deps location (PHP) + local _deps="/usr/local/lib/php" + + # `fetch` impl location (PHP) + local _impl="${DOCKER_FINANCE_CONTAINER_REPO}/src/finance/lib/internal/fetch" + + # NOTE: must reset IFS after executing local _ifs="$IFS" IFS=' ' @@ -857,14 +863,14 @@ function lib_fetch::__fetch_exec() # TODO: remove no-limit after internal fetching writes per-paginated instead of per-fetch lib_utils::deps_check "php" - _exec+=("php" "-d" "memory_limit=\"-1\"" "-d" "include_path=\"/usr/local/lib:${_dir}\"") + _exec+=("php" "-d" "memory_limit=\"-1\"" "-d" "include_path=\"${_deps}:${_impl}\"") lib_utils::print_debug "${_exec[@]}" # # Execute fetch # - "${_exec[@]}" "${_dir}/fetch.php" "$_type" "$_subtype" + __DFI_PHP_DEPS__="${_deps}" __DFI_PHP_ROOT__="${_impl}" "${_exec[@]}" "${_impl}/fetch.php" "$_type" "$_subtype" IFS="$_ifs" }