💻 Gold Standard CLI Commands¶
Powerful command-line tools for managing articles, imports, and maintenance.
The Gold Standard module includes a comprehensive set of CLI commands for automation, data management, and maintenance tasks.
Overview¶
flowchart TB
subgraph Commands["CLI Commands"]
direction TB
ART[Article Commands]
IMP[Import/Export]
MNT[Maintenance]
DEV[Development]
end
subgraph Article["Article Commands"]
A1[goldstandard:article:list]
A2[goldstandard:article:publish]
A3[goldstandard:article:archive]
end
subgraph Import["Import/Export"]
I1[goldstandard:import]
I2[goldstandard:export]
end
subgraph Maint["Maintenance"]
M1[goldstandard:cleanup]
M2[goldstandard:reindex]
M3[goldstandard:cache:clear]
end
ART --> Article
IMP --> Import
MNT --> Maint Usage¶
All commands are run via the XOOPS CLI:
Get help for any command:
Article Commands¶
List Articles¶
Display articles with filtering and formatting options.
Options:
| Option | Short | Description |
|---|---|---|
--status=STATUS | -s | Filter by status (draft/published/archived) |
--author=ID | -a | Filter by author ID |
--category=ID | -c | Filter by category ID |
--limit=N | -l | Maximum articles to show (default: 20) |
--format=FORMAT | -f | Output format (table/json/csv) |
--columns=COLS | Columns to display (comma-separated) |
Examples:
# List all published articles
php xoops_cli.php goldstandard:article:list --status=published
# List draft articles by specific author
php xoops_cli.php goldstandard:article:list -s draft -a 5
# Export as JSON
php xoops_cli.php goldstandard:article:list --format=json > articles.json
# Custom columns
php xoops_cli.php goldstandard:article:list --columns=id,title,status,views
Output:
+--------------------------------------+---------------------------+-----------+-------+
| ID | Title | Status | Views |
+--------------------------------------+---------------------------+-----------+-------+
| 550e8400-e29b-41d4-a716-446655440000 | Getting Started with... | published | 1250 |
| 550e8400-e29b-41d4-a716-446655440001 | Advanced Patterns | published | 890 |
| 550e8400-e29b-41d4-a716-446655440002 | Draft Article | draft | 0 |
+--------------------------------------+---------------------------+-----------+-------+
Total: 3 articles
Publish Articles¶
Publish one or more draft articles.
Options:
| Option | Description |
|---|---|
--all-drafts | Publish all draft articles |
--older-than=DAYS | Only drafts older than N days |
--dry-run | Show what would be published |
--notify | Send notification emails |
Examples:
# Publish single article
php xoops_cli.php goldstandard:article:publish 550e8400-e29b-41d4-a716-446655440000
# Publish multiple articles
php xoops_cli.php goldstandard:article:publish id1 id2 id3
# Publish all drafts older than 7 days
php xoops_cli.php goldstandard:article:publish --all-drafts --older-than=7
# Preview what would be published
php xoops_cli.php goldstandard:article:publish --all-drafts --dry-run
Archive Articles¶
Archive published articles.
Options:
| Option | Description |
|---|---|
--older-than=DAYS | Archive articles older than N days |
--low-views=N | Archive articles with fewer than N views |
--dry-run | Show what would be archived |
Examples:
# Archive single article
php xoops_cli.php goldstandard:article:archive 550e8400-e29b-41d4-a716-446655440000
# Archive old articles with low engagement
php xoops_cli.php goldstandard:article:archive --older-than=365 --low-views=100
Create Article¶
Create a new article from the command line.
Options:
| Option | Description |
|---|---|
--title=TITLE | Article title (required) |
--content=CONTENT | Article content |
--file=PATH | Read content from file |
--category=ID | Category ID |
--author=ID | Author ID (defaults to admin) |
--status=STATUS | Initial status (draft/published) |
--tags=TAGS | Comma-separated tags |
Examples:
# Create from file
php xoops_cli.php goldstandard:article:create \
--title="New Article" \
--file=./content.html \
--category=5 \
--tags="xoops,tutorial"
# Create and publish immediately
php xoops_cli.php goldstandard:article:create \
--title="Quick Post" \
--content="Article content here" \
--status=published
Import/Export Commands¶
Import Articles¶
Import articles from external sources.
Supported Sources:
| Source | Description |
|---|---|
file | Import from JSON/CSV/XML file |
wordpress | Import from WordPress export |
rss | Import from RSS feed |
url | Import from URL |
Options:
| Option | Description |
|---|---|
--format=FORMAT | Input format (json/csv/xml/wordpress) |
--category=ID | Default category for imported articles |
--author=ID | Default author |
--status=STATUS | Default status (draft/published) |
--dry-run | Preview without importing |
--skip-duplicates | Skip articles with matching slugs |
--update-existing | Update existing articles |
Examples:
# Import from JSON file
php xoops_cli.php goldstandard:import file ./articles.json --format=json
# Import from WordPress export
php xoops_cli.php goldstandard:import wordpress ./wordpress-export.xml \
--category=5 \
--status=draft
# Import from RSS feed
php xoops_cli.php goldstandard:import rss https://example.com/feed.xml \
--skip-duplicates
# Preview import
php xoops_cli.php goldstandard:import file ./data.csv --dry-run
Import File Format (JSON):
{
"articles": [
{
"title": "Article Title",
"content": "<p>HTML content...</p>",
"slug": "article-title",
"category": "tutorials",
"tags": ["xoops", "php"],
"author_email": "author@example.com",
"published_at": "2026-01-15T12:00:00Z"
}
]
}
Export Articles¶
Export articles to various formats.
Options:
| Option | Description |
|---|---|
--format=FORMAT | Output format (json/csv/xml/markdown) |
--status=STATUS | Filter by status |
--category=ID | Filter by category |
--since=DATE | Export articles since date |
--include-content | Include full content (default: metadata only) |
Examples:
# Export all published articles to JSON
php xoops_cli.php goldstandard:export ./backup.json \
--format=json \
--status=published \
--include-content
# Export recent articles to CSV
php xoops_cli.php goldstandard:export ./recent.csv \
--format=csv \
--since="2026-01-01"
# Export to Markdown files
php xoops_cli.php goldstandard:export ./markdown/ \
--format=markdown \
--include-content
Maintenance Commands¶
Cleanup¶
Clean up old data and optimize storage.
Options:
| Option | Description |
|---|---|
--drafts-older-than=DAYS | Delete drafts older than N days |
--orphaned-media | Remove orphaned media files |
--orphaned-tags | Remove tags with no articles |
--revisions-older-than=DAYS | Prune old article revisions |
--dry-run | Preview cleanup actions |
--force | Skip confirmation prompts |
Examples:
# Clean up old drafts
php xoops_cli.php goldstandard:cleanup --drafts-older-than=90
# Full cleanup
php xoops_cli.php goldstandard:cleanup \
--drafts-older-than=90 \
--orphaned-media \
--orphaned-tags \
--revisions-older-than=30
# Preview cleanup
php xoops_cli.php goldstandard:cleanup --drafts-older-than=30 --dry-run
Output:
Gold Standard Cleanup
=====================
Analyzing...
Found:
- 15 drafts older than 90 days
- 45 orphaned media files (12.5 MB)
- 8 orphaned tags
- 230 old revisions
Would delete:
- 15 drafts
- 45 files (12.5 MB)
- 8 tags
- 230 revisions
Continue? [y/N]
Reindex Search¶
Rebuild the search index.
Options:
| Option | Description |
|---|---|
--fresh | Drop and rebuild entire index |
--since=DATE | Only reindex articles modified since date |
--batch-size=N | Articles per batch (default: 100) |
Examples:
# Full reindex
php xoops_cli.php goldstandard:reindex --fresh
# Incremental reindex
php xoops_cli.php goldstandard:reindex --since="2026-01-01"
Clear Cache¶
Clear module caches.
Options:
| Option | Description |
|---|---|
--articles | Clear article cache only |
--templates | Clear template cache only |
--all | Clear all caches |
Examples:
# Clear all caches
php xoops_cli.php goldstandard:cache:clear --all
# Clear article cache only
php xoops_cli.php goldstandard:cache:clear --articles
Development Commands¶
Generate Article¶
Generate test articles for development.
Options:
| Option | Description |
|---|---|
--count=N | Number of articles to generate (default: 10) |
--status=STATUS | Status for generated articles |
--with-comments | Generate comments too |
Examples:
# Generate 50 test articles
php xoops_cli.php goldstandard:dev:generate --count=50
# Generate with comments
php xoops_cli.php goldstandard:dev:generate --count=20 --with-comments
Automation Examples¶
Cron Jobs¶
# Daily cleanup at 3 AM
0 3 * * * cd /path/to/xoops && php xoops_cli.php goldstandard:cleanup --drafts-older-than=90 --force
# Weekly full reindex on Sunday
0 4 * * 0 cd /path/to/xoops && php xoops_cli.php goldstandard:reindex --fresh
# Daily backup
0 2 * * * cd /path/to/xoops && php xoops_cli.php goldstandard:export /backups/$(date +\%Y\%m\%d).json --format=json --include-content
CI/CD Pipeline¶
# .github/workflows/content-sync.yml
name: Content Sync
on:
schedule:
- cron: '0 */6 * * *'
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Import from RSS
run: |
php xoops_cli.php goldstandard:import rss \
https://news.example.com/feed.xml \
--skip-duplicates \
--status=draft
- name: Notify
run: |
# Send notification about new imports