sync: auto-sync from DESKTOP-0O8A1RL at 2026-05-20 14:38:07
Author: Mike Swanson Machine: DESKTOP-0O8A1RL Timestamp: 2026-05-20 14:38:07
This commit is contained in:
@@ -548,3 +548,100 @@ Historical search: 21325332-a2a1-49c0-abb8-d0c6b88c7b0f (results to admin@cascad
|
||||
- Discord prompt: projects/discord-bot/DISCORD_CLAUDE.md
|
||||
- EXO InvokeCommand: POST /adminapi/beta/{tenant}/InvokeCommand
|
||||
- Historical search job: GET /adminapi/beta/{tenant}/HistoricalSearch('21325332-a2a1-49c0-abb8-d0c6b88c7b0f')
|
||||
|
||||
---
|
||||
|
||||
## Update: 14:34 PT — Flarum forum posts + WordPress search audit + /forum-post skill
|
||||
|
||||
### User
|
||||
- **User:** Mike Swanson (mike)
|
||||
- **Machine:** DESKTOP-0O8A1RL
|
||||
- **Role:** admin
|
||||
|
||||
### Session Summary
|
||||
|
||||
Posted two technical articles to community.azcomputerguru.com via paramiko SSH + PHP PDO inserts into the Flarum database. The Flarum posting workflow had to be developed from scratch this session — the forum's Cloudflare Bot Fight Mode blocks external API calls, and the local `curl` from IX returns empty due to an HTTP→HTTPS redirect issue on the vhost. The only working approach: SSH to IX, build a PHP script with PDO inserts, SFTP upload to `/tmp/`, execute via SSH channel, parse output for Discussion ID and Post ID.
|
||||
|
||||
First post was the OneDrive KFM folder redirection article (continued from a prior session context). The Flarum s9e TextFormatter XML format had to be reverse-engineered from existing posts — content is not stored as raw markdown but as a custom XML dialect with `<s>` (start marker) and `<e>` (end marker) wrappers inside each formatting element. A Python converter was written to translate markdown to this format. The first insert failed with a foreign key constraint because `posts.discussion_id` references `discussions.id` — reordering to insert discussion first (post refs are nullable at creation), then post, then UPDATE the discussion to set `first_post_id`/`last_post_id` resolved it.
|
||||
|
||||
After the OneDrive article was posted, ran a server-wide WordPress search indexing audit across the IX cPanel server. Found 194 wp-config.php files; 18 sites had `blog_public=0` (search discouraged). Of those, 7 were confirmed production sites whose owners were unaware. Fixed 13 sites (updated `blog_public` to 1), skipped the forms.bestmassageintucson.com site which is intentionally not indexed. The WordPress search audit findings were then written up as a second forum article and posted via the same paramiko workflow.
|
||||
|
||||
Converted the entire Flarum posting workflow into a reusable `/forum-post` skill at `.claude/commands/forum-post.md`. The skill covers all four phases: gather inputs (title, content, tag), preview, execute (paramiko SSH → SFTP upload PHP → execute → parse output), and report. Includes the complete Python md_to_s9e converter, PHP insert template with proper discussion-first ordering, error handling table, and hard rule to not verify via curl/browser. Added the command to CLAUDE.md's commands table.
|
||||
|
||||
### Key Decisions
|
||||
|
||||
- **paramiko over curl/API**: Cloudflare blocks external Flarum API calls; localhost curl on IX has redirect issues. Only working path is SSH→PHP→PDO. This is now the canonical approach documented in the skill.
|
||||
- **Python .replace() not f-strings for PHP template substitution**: XML content contains `{}` curly braces; Python f-strings would try to expand them, causing a KeyError. Used `.replace('%%XML_CONTENT%%', xml_content)` throughout.
|
||||
- **PHP nowdoc for XML content**: `<<<'FLARUM_POST_XML_END'` heredoc with closing marker at column 0 — no escaping needed for XML special characters inside.
|
||||
- **Discussion-first insert order**: Flarum's `posts.discussion_id` has a FK constraint. Insert discussion with NULL post refs, then post, then UPDATE discussion. Template hardcodes this order.
|
||||
- **bestmassage skip**: forms.bestmassageintucson.com is intentionally noindexed (likely a contact form subdomain) — excluded from the bulk fix.
|
||||
- **Unique /tmp filename per run**: `flarum_post_<timestamp>.php` prevents collision if skill is run concurrently; always cleaned up after execution.
|
||||
|
||||
### Problems Encountered
|
||||
|
||||
- **FK constraint on posts.discussion_id**: First insert attempt failed with `SQLSTATE[23000]: 1452 Cannot add or update a child row`. Fix: reorder inserts — discussion first (post refs nullable), then post, then UPDATE.
|
||||
- **PHP exit 255 no output**: `display_errors` was off by default. Added `ini_set('display_errors', 1); error_reporting(E_ALL);` to the PHP script to surface the FK error above.
|
||||
- **Shell quoting in WP-config scan**: First bash-based scan used nested quotes and got empty blog_public values for all sites. Fix: Python + paramiko SFTP to read files directly, parse with regex — no quoting issues.
|
||||
- **Python f-string curly brace conflict**: Initial PHP template using f-strings caused KeyError on `{` in XML content. Fix: switched to `.replace()` with `%%PLACEHOLDER%%` markers throughout.
|
||||
- **Flarum admin detection**: `users` table has no `is_admin` column. Admin status is in `group_user` table (group_id=1 = Admin). user_id=1 (MikeSwanson) confirmed admin.
|
||||
- **Chrome extension disconnected throughout**: Could not visually verify forum posts. Both posts confirmed via DB output only (Discussion ID/Post ID echoed by PHP script).
|
||||
|
||||
### Configuration Changes
|
||||
|
||||
- **Created:** `.claude/commands/forum-post.md` — Complete /forum-post skill with infrastructure refs, md→s9e converter, PHP template, paramiko pattern, error table
|
||||
- **Modified:** `.claude/CLAUDE.md` — Added `/forum-post` to Commands & Skills table
|
||||
- **Created (tmp):** `.claude/tmp/flarum_do_insert2.py` — Working OneDrive KFM post script
|
||||
- **Created (tmp):** `.claude/tmp/flarum_search_insert.py` — WordPress search post script
|
||||
- **Created (tmp):** `.claude/tmp/check_search.py`, `check_search2.py` — WP audit scripts
|
||||
- **Created (tmp):** `.claude/tmp/fix_search.py` — Bulk blog_public fix script
|
||||
|
||||
### Credentials & Secrets
|
||||
|
||||
- **IX SSH root password:** `t4qygLl7{1zJcUj#022W^FBQ>}qYp-Od` — vault: `infrastructure/ix-server.sops.yaml credentials.password`
|
||||
- **Flarum DB:** host=localhost (on IX), dbname=`azcompu_flarum`, user=`azcompu_flarum`, pass=`Fl@rum2026!CGS`
|
||||
|
||||
### Infrastructure & Servers
|
||||
|
||||
- **IX server:** 172.16.3.10 — root SSH, runs WHM/cPanel, hosts ~95 active WordPress sites + the Flarum forum
|
||||
- **Flarum forum:** community.azcomputerguru.com — DB on localhost (IX), admin user_id=1 (MikeSwanson), group_id=1=Admin
|
||||
- **WordPress sites:** Under `/home/*/public_html/` on IX. 194 wp-config.php files found, ~95 real sites
|
||||
|
||||
### Commands & Outputs
|
||||
|
||||
```bash
|
||||
# WP search audit (Python paramiko approach)
|
||||
py D:/claudetools/.claude/tmp/check_search2.py
|
||||
# Found 18 disabled, 77 enabled, rest errors/stubs
|
||||
|
||||
# Bulk fix
|
||||
py D:/claudetools/.claude/tmp/fix_search.py
|
||||
# FIXED (13): [list of sites]
|
||||
# SKIPPED (1): forms.bestmassageintucson.com
|
||||
|
||||
# Flarum post #1 (OneDrive KFM)
|
||||
py D:/claudetools/.claude/tmp/flarum_do_insert2.py
|
||||
# Discussion ID: 8
|
||||
# Post ID: 7
|
||||
|
||||
# Flarum post #2 (WordPress search)
|
||||
py D:/claudetools/.claude/tmp/flarum_search_insert.py
|
||||
# Discussion ID: 9
|
||||
# Post ID: 8
|
||||
```
|
||||
|
||||
### Pending / Incomplete Tasks
|
||||
|
||||
- **WebSvr GuruRMM agent**: Blocked — CentOS 7 glibc 2.17 incompatible with current musl/glibc build targets. Options: add `x86_64-unknown-linux-musl` build target to pipeline, or skip (WebSvr is legacy/decommission candidate). No decision made.
|
||||
- **IX backup offsite**: No remote transport configured in WHM. Comet Backup cron exists but binary not in PATH — non-functional. Needs S3/SFTP/Backblaze destination or Comet fix.
|
||||
- **azcomputerguru.com SEO remaining**:
|
||||
- Slider Revolution duplicate H1 — manual WP Admin fix
|
||||
- Footer social icons still `href="#"` — need actual social profile URLs from Mike
|
||||
- Google Search Console property + sitemap submission
|
||||
- **Chrome extension**: Remained disconnected all session — could not visually verify forum posts
|
||||
|
||||
### Reference Information
|
||||
|
||||
- Forum post #1 (OneDrive KFM): https://community.azcomputerguru.com/d/8-onedrive-kfm-fails-after-folder-redirection-migration-heres-whats-actually-going-on
|
||||
- Forum post #2 (WordPress search): https://community.azcomputerguru.com/d/9-wordpress-discourage-search-engines-setting-how-7-production-sites-lost-their-indexing
|
||||
- Flarum s9e XML format reference: `.claude/commands/forum-post.md` (Markdown → s9e XML Converter section)
|
||||
- forum-post skill: `.claude/commands/forum-post.md`
|
||||
|
||||
Reference in New Issue
Block a user