48 lines
1.8 KiB
Markdown
48 lines
1.8 KiB
Markdown
# Architecture Overview — Legacy PHP Product Module
|
|
|
|
## Context
|
|
This repo holds one legacy PHP module copied from production.
|
|
The module helps product staff create products and generate SEO text.
|
|
The module also runs one batch worker that updates OpenCart product descriptions.
|
|
|
|
Current raw source path was `project/new`.
|
|
Target stable path is `project/web/index/new`.
|
|
SQL baseline path is `project/sql/db-25052026.sql` and now contains sanitized synthetic development data.
|
|
|
|
## Main flows
|
|
1. User opens product form.
|
|
2. Form reads OpenCart data from MariaDB.
|
|
3. User can open AI helper page for one product text.
|
|
4. Bulk page writes product ids into `oc_product_queue`.
|
|
5. CLI worker reads queue, calls OpenAI, updates `oc_product_description`.
|
|
|
|
## Constraints
|
|
- Keep legacy behavior unchanged in layout and config features.
|
|
- Preserve file contents during move unless config externalization requires value lookup changes.
|
|
- Keep evidence in repo for each design change.
|
|
- Do not redesign auth or deploy in these features.
|
|
|
|
## System view
|
|
```mermaid
|
|
graph TD
|
|
U[Backoffice user] --> F[Legacy PHP web module]
|
|
F --> DB[(MariaDB / OpenCart)]
|
|
F --> Q[oc_product_queue]
|
|
W[worker_bulk.php CLI worker] --> Q
|
|
W --> AI[OpenAI API]
|
|
W --> DB
|
|
```
|
|
|
|
## Files and responsibilities
|
|
- `bootstrap.php`: shared local config loader and DB helper
|
|
- `config/local.example.php`: versioned config shape
|
|
- `config/local.php`: ignored local values file
|
|
- `index.php`: manual product create form
|
|
- `describe.php`: one-shot AI description helper
|
|
- `productos_bulk_update.php`: queue intake and worker log viewer
|
|
- `productos_modificados.php`: review processed items
|
|
- `worker_bulk.php`: batch generator and DB updater
|
|
- `inc/*`: shared layout, prompts, AJAX helpers
|
|
- `db/conn.php`: shared DB connection for web pages
|
|
- `logs/*`: runtime debug output from worker and AI calls
|