Toolvana: production-ready media tools platform (CodeIgniter 4)

- 134-tool registry with programmatic SEO (unique titles/H1/descriptions,
  JSON-LD graphs, sitemap index, canonical 301 enforcement via required filter)
- DB-backed job queue (SKIP LOCKED) with drivers: Ffmpeg, Images (GD),
  Pdf (qpdf/gs/poppler), Youtube (thumbnails), Qr (server-side PNG)
- Security: SSRF guard, MIME validation, rate limits, API-key auth,
  bcrypt admin login, security headers
- Admin panel: dashboard, tools/categories/guides CRUD, SEO audit,
  analytics, job inspector with retry, system health, feature flags
- Docker deployment (nginx + web/api FPM pools + scalable workers),
  PHPUnit suite (19 tests / 1139 assertions), PWA manifest + service worker
This commit is contained in:
deepseek
2026-08-23 07:10:30 +00:00
commit beaf0e1f37
217 changed files with 19619 additions and 0 deletions
+75
View File
@@ -0,0 +1,75 @@
<?php
declare(strict_types=1);
namespace App\Controllers\Admin;
use CodeIgniter\HTTP\ResponseInterface;
/** Guides CRUD with markdown body editing. */
final class GuidesAdmin extends AdminBase
{
public function index(): string
{
return $this->render('guides_index', ['guides' => $this->guidesModel()->orderBy('published_at', 'DESC')->findAll()]);
}
public function create(): string
{
return $this->render('guides_form', ['guide' => null]);
}
public function store(): ResponseInterface
{
$post = $this->request->getPost();
$body = (string) ($post['body_md'] ?? '');
$this->guidesModel()->insert([
'slug' => $post['slug'],
'title' => $post['title'],
'excerpt' => $post['excerpt'] ?? '',
'body_md' => $body,
'tool_slugs' => json_encode(array_filter(array_map('trim', explode(',', (string) ($post['tool_slugs'] ?? ''))))),
'seo_title' => $post['seo_title'] ?? null,
'seo_description' => $post['seo_description'] ?? null,
'reading_minutes' => max(1, (int) ceil(str_word_count(strip_tags($body)) / 220)),
'status' => $post['status'] === 'published' ? 'published' : 'draft',
'published_at' => date('Y-m-d H:i:s'),
]);
service('cache')->clear();
return redirect()->to('/admin/guides');
}
public function edit(int $id): string
{
return $this->render('guides_form', ['guide' => $this->guidesModel()->find($id)]);
}
public function update(int $id): ResponseInterface
{
$post = $this->request->getPost();
$body = (string) ($post['body_md'] ?? '');
$this->guidesModel()->update($id, [
'title' => $post['title'],
'excerpt' => $post['excerpt'] ?? '',
'body_md' => $body,
'tool_slugs' => json_encode(array_filter(array_map('trim', explode(',', (string) ($post['tool_slugs'] ?? ''))))),
'seo_title' => $post['seo_title'] ?? null,
'seo_description' => $post['seo_description'] ?? null,
'reading_minutes' => max(1, (int) ceil(str_word_count(strip_tags($body)) / 220)),
'status' => $post['status'] === 'published' ? 'published' : 'draft',
]);
service('cache')->clear();
return redirect()->to('/admin/guides');
}
public function delete(int $id): ResponseInterface
{
$this->guidesModel()->delete($id);
return redirect()->to('/admin/guides');
}
}