I think this is a nice Add-on (only juding it's functions), but I am somewhat curious about design decisions taken.
Would you mind giving some insights?
For example you've got code like
PHP:
if (false)
{
/**
* @disregard P1009 XenForo 2.3 resolves XF\Repository\SessionActivity to this canonical class.
*/
class XFCP_SessionActivity extends \XF\Repository\SessionActivityRepository
{
public function applyActivityDetails($activities)
{
}
}
}
This is basically NOOP and just seems there to please static analyzers / IDE; using smth, like
https://xenforo.com/community/resources/xf2-2-xf2-3-rename-aliases.9498/ should be easier & more efficient.
You are using multiple custom JavaScript files, but those are not minified
Your
Service classes are not actually XenForo services, why?
Thanks, and fair questions.
XFCP / static-analysis stubs
Yes, those
if (false) /
XFCP_* blocks are development-time scaffolding. XenForo creates the
XFCP_* parent aliases dynamically at runtime, but static-analysis tools and IDEs cannot always infer that cleanly.
The
SessionActivity example has an extra XenForo 2.3 compatibility wrinkle: XF Bot Guard registers against
XF\Repository\SessionActivity for XF 2.1/2.2 compatibility, while XF 2.3 resolves that to
XF\Repository\SessionActivityRepository. My local tooling checks that across XF 2.1.15, 2.2.19, and 2.3.12, including parent resolution and method signatures.
So yes, you correctly spotted tooling scaffolding, but it is there to support multi-version compatibility checks rather than runtime behaviour.
I have not used that rename-alias resource mostly because I prefer the add-on’s development tooling to remain self-contained.
Unminified JavaScript
Correct. The bundled third-party JS assets are minified where appropriate, such as FingerprintJS and ECharts, but my first-party JS files are currently shipped readable rather than minified.
They are syntax checked, covered by frontend/browser tests, and cache-busted with versioned URLs, but they are not minified. I agree this belongs in the release/packaging backlog.
Service classes
Most classes in
Zee\BotGuard\Service are not XenForo
\XF\Service\AbstractService services.
I’m using “service” in the application/domain-service sense: request gating, risk scoring, crawler verification, Cloudflare sync, dashboard building, health checks, and similar add-on logic. They are wired through a small add-on service factory so controllers, cron entries, jobs, and tests do not all need to hand-build the same dependency graphs.
Where the code is actually interacting with a XenForo service, it uses XenForo’s service helper.
More broadly, some of this visible scaffolding comes from trying to keep a security-sensitive add-on stable as a single developer. The local tooling covers PHPUnit, PHPStan, dead-code analysis, JavaScript checks, frontend/browser tests, real XenForo dev-database scenarios, runtime/performance diagnostics, representative traffic replay, and compatibility checks across supported XenForo versions.