Commit Graph
2 Commits
Author SHA1 Message Date
Divarion_D 70dadf0420 test: silence stdout/error_log noise during the test run
Exercised code paths echo diagnostics (dropOrphans() dropped-viewer lines,
GeoLite2 "[ERROR]" messages, ModuleLoader/GitHubReleases error_log output)
that clutter PHPUnit output without any test asserting on them:

- FanoutSyncOrphanTest / GeoLiteReleaseUpdaterTest: wrap each test in
  ob_start()/ob_end_clean() via setUp()/tearDown().
- tests/bootstrap.php: route error_log() to /dev/null.

No production behaviour changes.
2026-09-13 14:16:29 +03:00
Divarion_D 6662e72798 refactor(geoip): generic GitHubReleases client + domain-owned release sync
Make the GitHub-release GeoIP updates cohesive and testable, and keep the
GitHubReleases class a generic release client.

- GitHubReleases: drop the domain-specific getGeolite()/getIspDatabase()/
  getAsnCatalog() and the private releaseAsset() — they hard-coded the
  maxmind paths and GeoIP filenames, which don't belong in a generic
  GitHub-releases client. Add the generic assetUrl($version, $asset)
  primitive; domain code now composes its own specs around it. Also drop a
  stale usage example that referenced the removed getGeolite().

- New XcVm\Core\GeoIP\GeoLiteReleaseUpdater owns the release-asset sync:
  builds the GeoLite2-City/Country and GeoIP2-ISP specs (url via assetUrl,
  md5 via getAssetHash, local maxmind path), downloads them through ONE
  path, and records the version into maxmind/version.json. This unifies
  GeoIP2-ISP with GeoLite2 — the ISP now gets the same dir self-heal,
  checksum-tolerant "always save" behaviour, status lines and chmod 0750
  (was 0640) instead of the leaner fetchReleaseFile() it used before.

- MaxMindCronJob is now a thin orchestrator (updateGeoLite/updateIsp);
  AsnCatalogSync builds its own blocked_asns spec via assetUrl/getAssetHash.

- Tests: GeoLiteReleaseUpdaterTest (specs/paths/version, error paths) via a
  mocked repo + protected download/record seams; GitHubReleasesTest covers
  assetUrl().
2026-09-10 16:11:29 +03:00