2.5 KiB
tippligaforum — MySQL & phpBB Integration
Database connector, config loader, website HTTP client, and forum post management.
Classes
TippligaSQLConnector
Singleton JDBC connector to the phpBB MySQL database (d0144ddb). Connects to production via credentials from environment variables, with a fallback to localhost.
All major queries in one class:
getTeams(),getMatches(),getMatchdays(),getLeague()— read domain objectsgetUpdatedMatchdaysBasedOnMatches()— complex SQL that computes delivery deadlines from match times (usesDATEDIFFto split deadlines across days/weeks)getNextWhatsAppReminders(hours)— multi-table query finding users with missing bets on upcoming matchdays, joins with reminder tracking to avoid duplicatesupdatePost()/getPost()/getChecksumOfPost()— phpBB post CRUDexecuteQuery()/executeUpdate()— raw SQL accessmarkWhatsAppReminderAsSent()— logs sent reminders
Post updates use the phpBB checksum mechanism: post_checksum = MD5 of XML-escaped post text.
TippligaConfigProvider
Reads JSON configuration from phpBB forum posts. Configs are stored as topics under the Admin → Tippliga-Config → <season> forum hierarchy.
getTippligaConfig(config)— fetches post, strips[code]BBCode wrapper, parses JSONgetChecksumOfConfigPost(configFile)— reads post checksum for integrity verification
TippligaWebsiteConnector
HTTP client that logs into the phpBB frontend + admin panel and submits match results. Used by TLWMatchesResultsUpdater.
Login flow:
- GET login page → extract
creation_time,form_token,sidfrom hidden fields - POST credentials → capture session cookies
- GET admin panel → extract admin credential token
- POST admin login with
password_<credential>parameter
Result submission:
- GET results management page → extract CSRF tokens
- POST form with season, league, matchday, match scores (home, guest, overtime)
MatchesListCreator
Generates a JSON match list config from raw API-Football fixture data (read from S3). Creates SingleMatch config entries with matchday, matchtime, team names, and fixture IDs. Used by MatchesListForumUpdater to create fixture list forum posts.
MatchesListForumUpdater
For each league:
- Creates
MatchesListCreatorfrom S3 fixture data - Formats as pretty-printed JSON
- Wraps in
[code]BBCode - Finds the correct forum post (under
Admin → Tippliga-Config → <season> → Ligen → <country> <league>) - Updates the post text via
TippligaSQLConnector