forked from EvergreenCrypto/docker-finance
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:
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user