Background
The FOG base path /opt/fog is currently hardcoded in multiple places:
Problem
Non-standard installs (different base path) require manual edits across multiple files.
There is no single source of truth for the FOG base directory that both the shell installer
and the PHP runtime share.
Proposed Solution
- Audit all hardcoded
/opt/fog references in lib/common/functions.sh and replace with
$fogprogramdir (already defined in config.sh)
- Have the installer write
fogprogramdir into a PHP-readable location — either the
generated service/etc/config.php or a new packages/web/commons/fogpaths.php — as a
define() so the PHP runtime knows the real base path
- Update
system.class.php to derive FOG_BASE_DIR from that generated define rather
than hardcoding it, with /opt/fog as fallback if not defined
- All other path constants (
FOG_CACHE_DIR etc.) derive from FOG_BASE_DIR
Notes
Acceptance Criteria
Background
The FOG base path
/opt/fogis currently hardcoded in multiple places:lib/common/config.shsetsfogprogramdir="/opt/fog"but this doesn't flow into PHPpackages/web/lib/fog/system.class.phpdefinesFOG_BASE_DIRandFOG_CACHE_DIRas hardcoded strings (introduced in perf(settings): add TTL-based per-process cache to getSetting() with cross-process flush signal #849)
functions.shblocks reference/opt/fog/service,/opt/fog/log,/opt/fog/cacheetc. as literal strings rather than using$fogprogramdirProblem
Non-standard installs (different base path) require manual edits across multiple files.
There is no single source of truth for the FOG base directory that both the shell installer
and the PHP runtime share.
Proposed Solution
/opt/fogreferences inlib/common/functions.shand replace with$fogprogramdir(already defined inconfig.sh)fogprogramdirinto a PHP-readable location — either thegenerated
service/etc/config.phpor a newpackages/web/commons/fogpaths.php— as adefine()so the PHP runtime knows the real base pathsystem.class.phpto deriveFOG_BASE_DIRfrom that generated define ratherthan hardcoding it, with
/opt/fogas fallback if not definedFOG_CACHE_DIRetc.) derive fromFOG_BASE_DIRNotes
tftp setup, and PHP boot chain. Needs careful testing across all supported distros.
to keep that PR focused and reviewable.
fogproject-install-validation) should catch regressionsif tests are run after changes here.
Acceptance Criteria
fogprogramdirchange in.fogsettingsis fully respected by installerFOG_BASE_DIRfrom installer-written value, not hardcoded string/opt/fogstrings remain infunctions.sh