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++).
This commit is contained in:
2025-08-18 12:54:13 -07:00
parent c9406636c5
commit 07b710567d
18 changed files with 88 additions and 78 deletions

View File

@@ -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"
}