# admediacrons.com (crons) — repo context

> Curated overview for code_search. This repo has **no UI / left-panel menu** — it is
> a large collection of scheduled batch jobs. The card maps the **job families** and
> entry points instead. Source: `html/` (plain PHP scripts + `cron-cli/` task runner).

## Purpose
**AdMedia's scheduled batch / cron jobs.** ~4,000 mostly-PHP scripts (plus some
Python, shell, and Perl) run on a schedule (crontab / task runner) to produce
reports, adjust advertiser budgets, send stats emails, pull and push partner data
feeds, run reconciliation and invalid-traffic checks, and fire monitoring alerts.
Each script is typically a standalone job that connects to the AdMedia MySQL
databases (Admin, cms, Shorty/Stats) and/or partner APIs. This is the "back office
automation" repo — it is not a web app and has no navigation menu.

## Job families (top-level dirs under `html/`, ~127 total)
Grouped by theme (representative, not exhaustive):
- **Advertiser & campaign ops** — `advertisers/`, `advertisers_report/`, `campaigns/`,
  plus top-level scripts `AdvertisersBudgetAdjust.php`, `AdvertisersBudgetSpent.php`,
  `advertiser_stats_report.php`, `advertiser_status_cap.php`, `campaign_status.php`.
- **Affiliate / publisher** — `affiliates/`, `affiliate_partner_feeds/`,
  `aff-lib-stats.php`, `affiliate_r1_clicks.php`.
- **Reporting** — `adops_report/`, `houzz_daily_reporting/`, `all_advertisers_report.php`,
  DMA / domain report loaders (`addDmaReportData.php`, `addDomainReportData.php`).
- **Partner data feeds / integrations** — `amazon/`, `amazon_arb/`, `arb/`, `bing/`,
  `bing_catalog_upload/`, `facebook/`, `meta/`, `kelkoo/`, `kelkoodatafeed/`,
  `connexity/`, `klarna_feeds/`, `Pubadhub_feeds/`, `Shopping/`, and per-merchant dirs
  (`kohls/`, `macys/`, `dell/`, `bestbuy/`, `bedbathnbeyond/`, `lookfantastic/`, …).
- **Invalid traffic / fraud** — `InvalidTraffic/`, `ivt/`, `impressionWithoutClick/`,
  `reconciliation/` (e.g. `CRON-109-IVT.php`), `check_zero_ref_tags.php`.
- **Billing / payments** — `bill/`, `AuthorizeNetSubscription/`, `rebates/`, `currency/`.
- **Monitoring & alerts** — `monitor/` (`runSlackCron.php`), `alerts/`, `cb-alert/`,
  and `info_crons/` (`check_website_status.php`, `get_domains_ssl_info.php`,
  `critical_alert.php`, `search_api_alerts.php`, `potential_reach_tool_alert.php`).
- **Infra / runners** — `cron-cli/` (task loader + tasks), `lambda/`, `lambda-keywords/`,
  `kafka_workers/`, `db_to_redis/`, `OCI/` (`aws-oci-sync.sh`, `aws-oci-archive.sh`).
- **Other** — `CRM/`, `Coupons/`, `newsletter/`, `notification/`, `cpa/`, `cakeplatform/`.

## Key files / entry points
- `html/Cron.php` — base `Cron` class: opens mysqli connections to the Admin / cms /
  Shorty databases and provides shared curl/helper methods most jobs build on.
- `html/cron-cli/` — a task runner (`taskloader.php`, `app/`, `cli/`, `tasks/`) — the
  structured way newer jobs are registered and executed.
- `html/daily_stats_cron.php`, `html/cron_slick.php` — top-level daily aggregation jobs.
- `html/info_crons/` — health / monitoring crons (site status, SSL expiry, alerts).
- `html/include/`, `html/class/` — shared includes and helper classes.
- `html/.env.example` — expected environment configuration.

## Tech
Plain **PHP** (mysqli + curl), run on a schedule (crontab / `cron-cli` task runner),
against multiple **MySQL** databases (Admin, cms, Shorty/Stats) and many external
partner APIs. Small amounts of Python, shell, and Perl for specific jobs.

## Indexing notes
- First-party code is the PHP job scripts under `html/`. The many `html/**/vendor/`
  trees (Composer dependencies — google api client, guzzle, phpseclib, etc.) are
  third-party and are excluded from indexing.
- `html/Archive-No-Longer-Needed/` is retired/dead code — deprioritize it.
- Jobs frequently contain hard-coded DB credentials and `.pem` keys inline; results
  are passed through secret redaction before they reach the AI client.
